NJSON—One JSON Library to Rule Them All

submited by
Style Pass
2023-09-16 20:00:15

Working on Nyxt often means interacting with the Internet in ways no other Lisp project ever has. As a natural consequence of this, we've accumulated a set of libraries covering unexplored areas of Lisp use. One of these libraries is NJSON, a JSON handling framework that focuses on interactive exploration of huge JSON objects (as are often returned by APIs on the Web).

Most JSON-related libraries in Lisp are parsers. Though sometimes there are standalone libraries supporting JSON-adjacent standards like JSON Pointer or JSON Schema. Yet, despite a sea of libraries, there seems to be no library that optimizes a typical JSON workflow—getting through multiple layers of data, destructuring and validating objects, and type-checking parsed objects.

NJSON is such a library that optimizes exactly those things. It abstracts over JSON parsers and makes the data they return predictable and useful. Based on this abstraction, NJSON adds operations to explore data through multiple layers of objects and arrays; validate, destructure, and match the given JSON against an expected structure; and to use the found data with Lispy macros like jif and jbind aware of JSON specificities and conventions.

Leave a Comment