Personally I usually do stuff like that normalized to a database. Structured 
data you can mutate one-by-one is kind of the definition of what a relational 
database is supposed to do. I like tiny_sqlite a lot because it neatly maps 
type information without doing strings, and it's in-process- no seperate server 
to maintain.

To have structured data in Nim, what you are looking for is indeed a Nim 
object. You can scratch JSON completely for internal use, I'd say making it 
that central to data storage is an artifact of the JavaScript ecosystem. But if 
you need a JSON equivalent of your object to send to an API or something, then 
you would serialize the object to JSON. I used an ad-hoc proc for that but 
there might be library meanwhile.

I use my own `LimDB`, sometimes combined with the `flatty` serializer for using 
it with objects, when I just need to dump data somewhere that doesn't need to 
be mutated, such as for caching. It's also in-process and goes very well with 
`tiny_sqlite`.

Reply via email to