-
-
Notifications
You must be signed in to change notification settings - Fork 800
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
New JsonReadFeature: JSON5 compatible multi-line String values #612
Comments
First a quick note: trailing commas are optionally available, but like anything that breaks strict JSON compliancy, must be explicitly enabled. JsonFactory f = JsonFactory.builder().
// note: `JsonReadFeature` added in 2.10: there is also deprecated `JsonParser.Feature` equivalent
.enable(JsonReadFeature.ALLOW_TRAILING_COMMA)
.build(); Second part, possibly allowing multi-line text, would require more work. Full JSON5 or HJSON support might require different backend (new format backend in |
Can you please add the feature ALLOW_TRAILING_COMMA to the documentation I referenced? It is missing there. Thank you. |
@literakl yes, I'll try to get to adding that too. I wish project had more contributors to help with documentation, too, so it'd be more up to date. On new feature: the likeliest route these days is for someone to implement it, send a PR. |
If I understand correctly you want this JSON5 example to work.
If you use JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS then this example works (note: no backslash) but the example mentioned above not.
However, it seems that if you use both JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS and JsonReadFeature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER the JSON5 example works too (as does the second one).
Hope this helps @literakl ! |
I read the JsonParser features and it is great that there are relaxed features available. I was reading JSON5 and HJSON and they have some interesting features.
Full support for JSON5 would be great. I especially miss:
Multiline strings:
Trailing comma:
{
"field": 1,
}
It would be great if you could consider an addition of these features. I have not found such request between issues. Thank you
The text was updated successfully, but these errors were encountered: