Simdjsont.Validate
simdjsont · API reference
JSON validity checks.
Validation parses the input with simdjson but does not decode it into an OCaml value. Use is_valid for a boolean fast path and check when you want an error message.
match Simdjsont.Validate.check payload with
| Ok () -> handle_valid payload
| Error msg -> Printf.eprintf "invalid JSON: %s\n" msgval is_valid : string -> boolis_valid json returns true if json is valid JSON.
val check : string -> (unit, string) resultcheck json returns Ok () if json is valid JSON, otherwise Error msg.
val is_valid_bigstring : Raw.buffer -> len:int -> boolis_valid_bigstring buf ~len is like is_valid for the first len bytes of a bigstring. Parsing is zero-copy when buf is already padded.
val check_bigstring : Raw.buffer -> len:int -> (unit, string) resultcheck_bigstring buf ~len is like check for a bigstring.