Streamful way to serialize non-serde structures into JSON

in my application, I have a data model stored in couple of structs, and it is quite large. Also the app is going to execute in memory-restricted environment.
Now, I want to serialize this structure into JSON format, with as little consumed memory as possible.

Simplest solution would be, create parallel structs marked with #serde, fill this by traversing my data, and then save it with serde.
But that will consume about the same memory already consumed by original data.

The other option is, generate raw JSON while traversing my data. That is probably the way to go...
but is there any clever helper library making this task easier? I mean, support low-level syntax, watch against improper JSON structuring etc. Thanks for any hints.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.