Module Jsonxt__.Yojson
JSON compatibility differences
The underlying parser used by the Yojson compatibility modules are RFC 8259 compliant except for specific extensions. In particular:
- Control characters must be escaped as defined by RFC 8259
- Comment are supported with /* */ and // at the end of the line
- Variants and tuples are supported but with syntax changes noted later
- Object keys must be quoted. So {ab:10} is not valid and must be encoded as {"ab":10}
- Variant names must be quoted. eg. <"ab"> and <"ab":10>
Behavioural differences
- The
lexer_statedata structure is used to report errors but not updated during the parsing of the input - The optional
bufparameter is ignored - Error messages are likely to be different
- The utils module module uses the
Failureexception rather than Yojson's specialist exceptions
type lexer_state={buf : Stdlib.Buffer.t;mutable lnum : int;mutable bol : int;mutable fname : string option;}
val init_lexer : ?buf:Stdlib.Buffer.t -> ?fname:string -> ?lnum:int -> unit -> lexer_state
module Basic : sig ... endmodule Safe : sig ... endmodule Raw : sig ... end