question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Unquoted Values

See original GitHub issue

In both Gson and org.json a unquoted value will be interpreted as a string. So given this array (note that apple is not quoted):

[33.5, 42, "foo", true, apple]

The resulting ArrayNode equivalent in those frameworks (JsonArray and JSONArray respectfully) will interpret it as

[33.5, 42, "foo", true, "apple"]

I have a OSS utility (Unirest-Java), that will allow users to bring their own favorite Json parsing engine. So I have an abstraction for them, and trying to make them operate with the same rules. This one I can’t deal with unless Jackson were to handle it. I noticed you have a JsonReadFeature for ALLOW_UNQUOTED_FIELD_NAMES, it would be super cool if there was a ALLOW_UNQUOTED_VALUES

Thanks for all the hard work. Jackson is a fantastic library and a real backbone of the world of Java you should be really proud of it!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
cowtowncodercommented, Oct 18, 2021

Yes, this would require a new option like JsonReadFeature.ALLOW_UNQUOTED_VALUES. I probably won’t have time to tackle this, but maybe someone else might find time. This feature would need to be implemented for all 4 backends (Reader, InputStream, DataInput, non-blocking); some of code used for unquoted field names might prove valuable.

One thing to note is that the definition of where an unquoted value ends will probably require “interesting” heuristics – given that such values are not legal JSON (and shame on org.json / Gson accepting them by default…), there is no definition of how such values should be decoded; choice of end markers is rather large.

0reactions
micwcommented, Nov 7, 2022

Yes. Once you leave the spec path, results might be surprising 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unquoted attribute values in HTML and CSS/JS selectors
So, a valid unquoted attribute value in CSS is any string of text that is not the empty string, is not just a...
Read more >
How to parse unquoted numeric json values in java?
There is nothing special about unquoted numeric values. All the JSON parsing libraries will support that. Share.
Read more >
Handling non-compliant JSON with Jackson - cowtowncoder
Jackson support for non-compliant JSON: mechanisms ... Allow fully unquoted Object keys (but not String values): presumably just for … less ...
Read more >
JsonParser.Feature (Jackson-core 2.9.0 API) - FasterXML
Feature allows the support for "missing" values in a JSON array: missing value ... Feature that determines whether parser will allow use of...
Read more >
WordPress prepare() and unquoted values
While it will take a while for this to be supported, we are looking at how feasible it would be to disable the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found