Files
weaseljson/README.md
2025-05-20 12:43:26 -04:00

908 B

Weaseljson

An rfc8259-compliant streaming json parser

Features

  • SAX-style api
  • No memory allocations during parsing
  • O(1) stack memory usage
  • Streaming api - no need to buffer the entire document in memory. Parsing is resumed when more data is available
  • Strings are unescaped in place before they're presented. No unicode normalization is performed
  • Robust to crashes with untrusted input

Rfc8259 conformance notes

  • There are no limits on number precision. Numbers are only validated syntactically and are presented as is
  • Only utf-8 is accepted
  • Invalid utf-8 is rejected
  • Byte order markers are rejected
  • Invalid escaped utf16 surrogate pairs are rejected
  • Documents that are too deeply nested are rejected to control memory usage
  • Duplicate keys are presented

Caveats

  • Users should be prepared to discard work done during SAX callbacks if the document is ultimately rejected