logoalt Hacker News

boricjtoday at 12:09 AM0 repliesview on HN

I've just started a new personal project, a C++20 library for running composable visitors over data documents and data models with JSON/CBOR semantics, DOM-less.

Basically, if you define a data model with bindings, you can inject data into it or extract data from it by running SAX-style visitors. You can use serializers/deserializers for standard formats like JSON/BSON/CBOR/CSV, or you can define custom formats for formating structured data however you want to. You can also run a serializer visitor on a deserializer to convert between formats. You can compose filter visitors to extract a subtree or filter out keys. And it's designed to fit on microcontrollers with very limited dynamic memory allocations, because it either streams data on-the-fly or works directly with the underlying data format in a big preallocated buffer.

I worked with libraries that offered a subset of these features before in my professional career (even built one myself), but recently I've had an epiphany (a document can also be used as a data model) that makes me think I can create something elegant and unique.