Skip to main content

validate

Function validate 

Source
pub fn validate(buf: &[u8]) -> Validity
Expand description

JSON_Validate: is this a complete, valid JSON document?

Strict ECMA-404, as coreJSON is strict: no trailing commas, no leading zeroes, no unescaped control characters in strings, no over-long UTF-8, no lone surrogates, and nesting no deeper than MAX_DEPTH.

A scalar at the top level is valid42 and "hi" are documents — which is ECMA-404 and not the older RFC 4627 rule that a document must be an object or an array. The C makes that switchable with JSON_VALIDATE_COLLECTIONS_ONLY; this follows the default.