- What counts as valid
- Validation follows RFC 8259 as implemented by JSON.parse. Strings must use double quotes, keys must be quoted, trailing commas are rejected, and comments are not allowed. Any of NaN, Infinity or undefined is invalid. A bare value such as 42 or "text" is a valid JSON document on its own.
- The structural summary
- For valid documents you get the top-level type, counts of objects, arrays, strings, numbers, booleans and nulls, the total key count, and maximum nesting depth. Depth is useful when a consumer imposes a limit, and the type counts often reveal that a field you expected to be a number is arriving as a string.
- Common errors and what causes them
- A trailing comma before } or ] is a common failure, usually from hand-editing. Single-quoted strings come from pasting JavaScript object literals rather than JSON. "Unexpected end of input" means the document ended before a value or structure was complete. "Unexpected non-whitespace character after JSON" usually means extra content follows the first value. If each line contains one complete value, the file may be JSON Lines rather than a single JSON document.