d3x0r / JSON6

JSON for Humans (ES6)
Other
237 stars 15 forks source link

Stringify support #21

Closed keith0305 closed 3 years ago

keith0305 commented 4 years ago

Hey,

Very cool library and I appreciate the hard work, but one thing that kept me from using this in a large project is the missing Stringify feature.

Are you planning to add it eventually or that is not in your plan at all? If no, why? :(

If yes, what are the difficulties? Do you need help? I am no expert especially on the low-level stuff like parsing, but today I will clone the repo and dive into the source code a bit.

d3x0r commented 4 years ago

Somewhat; there's not a lot of benefit from a stringifier for this. I did add one in https://github.com/d3x0r/jsox which is very similar code to this.

What things would you expect this to do better than JSON.stringify() ?

keith0305 commented 4 years ago

I am working on a custom CMS system where I am using nodejs to generate a JSON that will eventually be edited by hand by developers or admins. This is where I need those JSON files to be stored in "JSON6" format so that it would be easier to read and edit by a human.

I am considering JSON5 library but JSON6's speed is unmatched (seriously it's so fast).

On top of that, I am hoping to see multi-line strings be stored in backtick strings.

d3x0r commented 4 years ago

Oh okay. I will look into adding that. it's been on my backlist a while :)

keith0305 commented 4 years ago

Cool! Appreciate your hard work man.

d3x0r commented 3 years ago

I published 1.1.1 on npm (up from 1.0.8), it includes a custom stringifier that emits NaN and Infinity, and unquoted field names (unless the need a quote).

keith0305 commented 3 years ago

Omg thank you ♥