Common intermediate programmer mistake: trying to use the same abstraction for inputting a given thing, vs outputting it.
Advanced programmers know these are fundamentally different tasks deserving independent abstractions.
Example: JSON
For outputting, there's no value in constructing a bunch of pointless hash maps in memory. Just stream the data out with some basic API to ensure correct syntax and nesting.