We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

Back to home

JSON River – Parse JSON incrementally as it streams in

Source

Hacker News

Published

TL;DR

AI Generated

JSON River is a tool that allows for incremental parsing of JSON data as it streams in, suitable for scenarios like network requests or language models. It provides increasingly complete values as the data is received, ensuring correctness by matching JSON.parse behavior and handling invalid input gracefully. The tool maintains invariants such as preserving data types and only modifying arrays and objects in specific ways. While JSON River is small, fast, and dependency-free, it is recommended to use JSON.parse for non-streaming scenarios for better performance. Development details include installation instructions, testing, and linting processes.