Skip to content

feat: support trailing commas #751

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

Closed
wants to merge 1 commit into from

Conversation

zirkelc
Copy link
Contributor

@zirkelc zirkelc commented Jul 15, 2025

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.

@mattbaileyuk
Copy link
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.

@zirkelc
Copy link
Contributor Author

zirkelc commented Jul 24, 2025

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! :-)

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

Successfully merging this pull request may close these issues.

Support for trailing commas
2 participants