Closed Gama11 closed 5 years ago
It should be done for JsonWriter
. Since cc79ec2d54583a5fe74b6e160a080458af6854ee, it accept an indentation character as an optional argument.
I'm also working to add it for JsonSchemaWriter
, but I didn't expect to touch that thing again, so it may take a while to have it works without breaking.
Awesome, thanks. :)
I guess in an ideal world, JsonSchemaWriter
would actually use JsonWriter
for writing? Although that may be difficult because of macro-in-macro...
Yeah that is the current plan, to rewrite JsonSchemaWriter
to generate an object that can be stringified by JsonWriter
.
However, I don't think using JsonWriter
in the schema macro would be a problem, as both JsonParser
and JsonWriter
are recursive macros.
With cbb8ec4875fd158b0f942306024a761e05480329, indentation support has been added to the JsonSchemaWriter
(via the constructor). Also an indentation bug with Array
has been fixed.
Something's not quite right with indentation in arrays with struct literals:
Should be fixed by a84680aa972f66fdf4278aad000696920ba9ea71.
Haxe's
Json.stringify()
supports an optionalspace
parameter for formatted / indented output. json2object'sJsonWriter
seems to be lacking this feature.I guess the same is true for
JsonSchemaWriter
, so far I've dealt with it simply by doing aJson.stringify(Json.parse(...), "\t")
there.