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.

Allow serialization with Single Quotes \' in stead of Standard Double Quotes \"

See original GitHub issue

Adding 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:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
angelyancommented, Oct 21, 2020

@cowtowncoder is this not possible already in 2.12 with new JsonFactoryBuilder().quoteChar('\'').build()?

0reactions
cowtowncodercommented, Oct 21, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

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