Closed felipecrs closed 1 year ago
I think that a new function (fromJsonc
) would be better than adding JSONC support to fromJson
, because you can reasonably do fromJson | toJson
and get the input back out (possibly sorted, possibly pathologically unsorted because Go), but you can’t do that with JWCC. I don’t believe we would want to support a toJsonc
.
I also think so, there is no reason to add a function toJsonc
, especially considering that comments can't be retained anyway.
I see that JWCC above links to a blog. Is that the formal specification? Is there any test suite to verify implementations?
@FranklinYu your questions are answered in the blog post :)
Is your feature request related to a problem? Please describe.
I'm trying to use modify templates to handle both my VS Code settings.json and also my Windows Terminal settings.json. However, their formats are JSON with Comments, which differs from regular JSONs a little.
Currently, if there are comments in the JSON, the
fromJson
will silently loadno value
. Effectively, at the end of the modify template, it will basically clean everything up that was in the file previously.Describe the solution you'd like
I believe it would be nice to make fromJson accept JSON with Comments as well (which is a superset of JSON), or, a new function like
fromJsonc
.Describe alternatives you've considered
I have a
.chezmoiscript
that backs up my configuration before actually changing it so that if something wrong happens, I can still recover.Additional context
I found this library for Go which seems to be actively maintained: