Allow serialization with Single Quotes \' in stead of Standard Double Quotes \"
See original GitHub issueAdding something like this feature JsonWriteFeature.USE_SINGLE_QUOTE
. Permitting to serialize:
{"name": "value"}
to {'name': 'value'}
and if also JsonWriteFeature.QUOTE_FIELD_NAMES
is disabled to {name: 'value'}
.
I know this is not standard JSON, but might be really helpful to get TypeScript-formatted JSON.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Tell Json.Net to write a single-quote rather than a double ...
Yes, this is possible. If you use a JsonTextWriter explicitly instead of using JsonConvert.SerializeObject() , you can set the QuoteChar to ...
Read more >How to handle single quote in the JSON string - Microsoft Learn
I have created a class with list of properties where one of the property contains name which contains single quote. But when I...
Read more >'Single' vs "Double" quotes for strings in javascript - Flexiple
Both single (' ') and double (" ") quotes are used to represent a string in Javascript. Choosing a quoting style is up...
Read more >How to parse single quotes JSON using Jackson in Java
We can configure Jackson to allow single quotes while parsing the JSON using the ALLOW_SINGLE_QUOTES enum of the JsonParser class. Note: To use...
Read more >Strings in YAML - To Quote or not to Quote | tinita [blogs.perl.org]
If you look at JSON, you have only one style to encode strings, and that's the double quoted style which doesn't allow literal...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cowtowncoder is this not possible already in 2.12 with
new JsonFactoryBuilder().quoteChar('\'').build()
?I am sure there are different preferences; some might prefer minimal escaping, others keeping both. It probably seemed safer not to assume that double-quotes should be kept quoted.
If there is some follow-up improvements needed, filing a new issue is always possible.