diff --git a/src/core/opamConsole.ml b/src/core/opamConsole.ml index 0f0f3314b2f..a7ef756bf43 100644 --- a/src/core/opamConsole.ml +++ b/src/core/opamConsole.ml @@ -1102,17 +1102,6 @@ module Tree = struct Buffer.add_char buff '\n'; go_children "" children; msg "%s" (Buffer.contents buff) - - let rec to_json ?(flatten=false) ~encoder { value; children } : OpamJson.t = - let fields = - match children with - | [] -> [] - | _ -> ["children", `A (List.map (to_json ~flatten ~encoder) children)] - in - match flatten, encoder value with - | false, value -> `O (("value", value) :: fields) - | true, `O fields' -> `O (fields' @ fields) - | _, _ -> invalid_arg "encoder returned a non-object value" end (* This allows OpamStd.Config.env to display warning messages *) diff --git a/src/core/opamConsole.mli b/src/core/opamConsole.mli index 9f1484cb114..3328da0291f 100644 --- a/src/core/opamConsole.mli +++ b/src/core/opamConsole.mli @@ -179,8 +179,4 @@ module Tree : sig (** Prints the given tree as a Unicode/ASCII art. @param printer may return a multi-line string, but should not return an empty string. *) val print: ?symbols:symbols -> printer:('a -> string) -> 'a t -> unit - - (** Encodes the given tree as JSON. - @param encoder must return [`O fields] when [~flatten:true]. *) - val to_json: ?flatten:bool -> encoder:('a -> OpamJson.t) -> 'a t -> OpamJson.t end