Module Jsonxt.Utilities
json tree conversion functions
Support various converstions of a json tree
- To strict and basic types
- To strings, intended mostly for debugging
Tree type conversion
val to_basic : 'a Jsonxt__.Json_internal.constrained -> Basic.jsonto_basic jsonconvertsjsoninto theBasic.jsontype transforming variants that do not comply to that type. All json types can be converted
val to_strict : 'a Jsonxt__.Json_internal.constrained -> Strict.jsonto_basic jsonconvertsjsoninto theStrict.jsontype transforming variants that do not comply to that type. In particular ints are converted to floats. All json types can be converted
Tree conversion to strings
val json_to_string_repr : 'a Jsonxt__.Json_internal.constrained -> stringjson_to_string_repr jsonconvertsjsoninto a string representation of the tree. This is not JSON but a textual represenation of the json tree. eg`Assoc [ "Boo1": `List [] ]
val json_to_string : 'a Jsonxt__.Json_internal.constrained -> stringjson_to_string jsonconverts the json tree to standard JSON in compact format. The function does not apply any type constraints to the json tree
val json_stream_to_string_repr : 'a Jsonxt__.Json_internal.constrained_stream -> stringjson_to_string_repr jsonconvertsjsoninto a string representation of the json_stream element. This is not JSON but a textual represenation of the json_stream_type. eg `Ae
val equal : 'a Jsonxt__.Json_internal.constrained -> 'a -> boolequal json1 json2recursively compares the two trees returning true if they are equal. Object key/value pairs do not need to be in the same order. Duplicate keys are equal if and only if the key/value pairs are in the same order in each tree.