golden-fleece icon indicating copy to clipboard operation
golden-fleece copied to clipboard

Add option to force quoted keys.

Open jdalton opened this issue 6 years ago • 4 comments

I know golden-fleece works on JSON5 but I'm finding it handy to edit package.json files (nothing fancy). However, since it's plain old JSON the keys generated need to be double quoted. In cases of creating new keys golden-fleece currently leaves them unquoted unless needed-to for valid syntax.

jdalton avatar Apr 09 '18 07:04 jdalton

Would it be enough if it used the existing conventions? i.e. if the majority of existing keys used double quotes, use double quotes for new keys; if the majority of existing keys that don't require quotes aren't quoted, only use quotes for keys that do require it.

Or could there be a situation where there are no initial keys on which to base that judgment?

Rich-Harris avatar Apr 09 '18 15:04 Rich-Harris

In my case there are existing keys, however a general option couldn't hurt either for cases where the start is an empty JSON object {}.

jdalton avatar Apr 09 '18 15:04 jdalton

I just used golden-fleece today and ran into this again 🙃 It's been just a bit (burnout is real) is golden-fleece still THE jam for this kind of thing or has something else emerged?

jdalton avatar Aug 24 '21 23:08 jdalton

For dealing with just JSON (not JSON5), I forked this repo and called it silver-fleece. It will always use double-quote keys :)

evertheylen avatar May 12 '23 13:05 evertheylen