-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Is there a function available, that should not exist?
Using Yojson.Safe.Util.to_string
compiles, seems to be valid function.
But I get:
Used string:
{"foo":"bar"}
Fatal error: exception Yojson__Safe.Util.Type_error("Expected string, got object", _)
Raised at Yojson__Safe.Util.typerr in file "lib/read.ml", line 2901, characters 20-60
Called from Main in file "main.ml", line 8, characters 21-50
The Code:
let js_str = {|{"foo":"bar"}|}
let () =
print_endline "Used string:";
print_endline js_str;
let js = Yojson.Safe.from_string js_str in
let again_js_str = Yojson.Safe.Util.to_string js in (* exception *)
(*
let again_js_str = Yojson.Safe.to_string js in (* works well *)
*)
print_endline again_js_str
Using Yojson.Safe.to_string
instead blows away the problem.
Metadata
Metadata
Assignees
Labels
No labels