Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need an option for prettifying the output string #5

Open
kevinresol opened this issue Nov 4, 2016 · 3 comments
Open

Need an option for prettifying the output string #5

kevinresol opened this issue Nov 4, 2016 · 3 comments

Comments

@kevinresol
Copy link
Member

as in std lib you can do haxe.Json.stringify(obj, '\t') to make the output tab-indented.

@back2dos
Copy link
Member

We can do this, although it will hurt performance, because the writer will have to calculate at runtime many parts that now are constant. Currently, we have the prefix in '{"key":'+value already precomposed. And we'd have to cut the constant into three bits.

Do you need this for debugging only? In that case roundtripping through the haxe.Json will do :D

@back2dos
Copy link
Member

On a more serious note, a streaming json formater might actually be a useful tool, even beyond tink_json. It would just keep a stack for the current state and insert white space at the appropriate places as data passes through. So it wouldn't have to ever create the actual values in memory.

@kevinresol
Copy link
Member Author

Well, debugging is one point, but I also prefer outputting formatted json on my REST api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants