-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Allow trailing comma in objects and arrays #1062
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
Conversation
I expect this should bump the version. If we keep special case for |
I like this feature. I personally use trailing commas in Python all the time. But (A) this PR currently fails for AppVeyor. And (B) it's still a draft. Is that because of the problem with old versus new Reader in the tests? |
(A) just seems to be because I haven't run clang-format. I'll get that done. (B) is because of the problem with old versus new Reader. I have currently implemented the change in both the old and new Reader, but from #1043 (comment), it sounds like I should revert the change to the old reader, since it's deprecated and shouldn't be changed. In that case, in order for the tests I have added to pass, we will need the change in 836d954 to be merged, so that the tests are only run for the new Reader. |
@cdunn2001: Would you prefer to have support for trailing commas in both the old and the new Reader, or just in the new one? |
# Conflicts: # src/test_lib_json/fuzz.cpp
Trailing "slashes"? If you mean trailing "commas", just in New is fine. But we need to be sure we have test coverage first. |
Yes, I mean trailing commas. I've edited it in the comment above. Let's keep this pull request as a draft until #1053 is merged. Then I'll revert the changes to the old Reader. |
We can merge #1053 after clang-format there. Then yes, we can merge this one. |
Ready for review! I think we can go to the next step now. @kimsey0 |
replaced by #1098 |
Fixes #1043.
Allows one trailing comma in objects (
{ "count" : 1234, } = { "count" : 1234 }
) and arrays ([1,] = [1]
), which is ignored.Introduces new feature
allowTrailingCommas
, which can be used to switch this on and off. It is enabled by default, unless in strict mode.Currently only allows trailing commas in arrays if
allowDroppedNullPlaceholders
is off, since otherwise, we'd break clients that depend on[1,]
being parsed as[1,null]
.In this draft version, introduces the changes both in the legacy
Reader
and the modernOurReader
. However, this can be changed if #1053 (comment) is handled and we allow having modern only tests.