-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
Add JsonParser.ALLOW_TRAILING_COMMA
to work for Arrays and Objects
#323
Comments
See also #118 |
Did you read documentation of this feature? |
Yes-- the behavior is consistent with its documentation. However... I submitted a pull request in #234 that covers the trailing commas use case for both arrays and objects, which I closed after you mentioned that this feature had been merged. I'd really like some level of support for trailing commas in objects as well. I'm happy to reopen the pull request and/or take another approach that you suggest. |
@bdhess Hmmh. Ok. So, the issue as I recall is/was that whereas with arrays it is possible to stuff add logical I am open to improvements here; perhaps a separate feature would make sense if we can figure out reasonable behavior and implementation for backend. |
Agree that there's no logical parallel to inserting I would propose that a feature Based on the work I did previously in #234, I think it would be straightforward to implement this way, so if you're okay with this outline in principle, I'd be happy to dust that review off and implement with the below as test cases. Default
|
As I think about this more, I don't think it would be any more complicated to support multiple trailing commas at the end of an array or object definition, and some may find that behavior more desirable. |
Agreed, trailing commas seem like something that could be supported. My only concern here is (as before) in keeping performance overhead minimal; and that just means trying to keep control flow changes to minimum (and run perf tests before & after). So, PR sounds like a good idea. On naming, perhaps it should be One small (?) question wrt backwards compatibility is wrt behavior with trailing array commas... I think those are accepted currently, and if so would be good to also support without users having to enable another feature. But not sure how that should work. |
A couple of observations as I've implemented: I mistakenly proposed that Looked into @cowtowncoder's feedback regarding trailing commas in an array being permitted today. This doesn't appear to be the case, and I've written a test case that asserts the opposite, which passes against
Perf tests are running now, and assuming they look good, I'll drop the PR shortly. |
JsonParser.ALLOW_TRAILING_COMMA
to work for Arrays and Objects
Implemented for 2.9.0. |
@bdhess Any tips to deserialize |
Not sure if the inconsistency is intentional?
Seems weird that the feature permits
["a","b",]
but not{"a": 1, "b": 2, }
.The text was updated successfully, but these errors were encountered: