Closed
Conversation
Member
|
Given JSONata is implemented in languages other than Javascript too, I am unsure about this change. I feel like the input should be valid JSON, even though I'm pretty sure I've fallen foul of this too, and appreciate the attempt to make things easier. |
Contributor
Author
|
Hey @mattbaileyuk thanks for your feedback! Yeah I expected that this might be controversial as trailing commas are not liked by everyone even in the JS world 😅 Feel free to close the PR if you decide not to go that way! :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #637
It's probably a philosophy question whether trailing commas should be supported: they are valid in JavaScript but not valid in JSON.
I encountered many cases where I removed a line from an JSONata expression but I forgot to remove the trailing comma in the previous line and encountered an error.
Such cases would usually be auto-fixed by the linter/formatter/IDE, but since we don't have built-in support for JSONata, I personally think trailing commas would be convenient to reduce such stylistic errors.