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.

toJson escapes "=" unnecessarily in raw strings

See original GitHub issue
What steps will reproduce the problem?
1. Create an object with a single String field.
2. Set field to "http://someUrl.com?a=b"
3. Attempt to convert the object to json via gson.toJson

What is the expected output? What do you see instead?
I would expect the URL to be serialized exactly as it is written. Instead, 
the equals sign is encoded as \u003d.

What version of the product are you using? On what operating system?
1.4


Original issue reported on code.google.com by arcanef...@gmail.com on 20 Apr 2010 at 5:08

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7

github_iconTop GitHub Comments

12reactions
GoogleCodeExportercommented, Mar 19, 2015
Hope this will help you :

Gson gson = new GsonBuilder().disableHtmlEscaping().create();

Original comment by Cassel.G...@gmail.com on 30 Jul 2010 at 7:33

4reactions
GoogleCodeExportercommented, Mar 19, 2015
Working fine for me now If I use below code to create Gson object. 

Gson gson = new GsonBuilder().disableHtmlEscaping().create();

Thanks to Cassel.Guillaume.

Original comment by sadineni...@gmail.com on 18 Aug 2010 at 8:30

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to escape special characters in building a JSON string?
Doubling a single quote in a JSON string doesn't escape it. It just means your string contains two single quotes, instead of one....
Read more >
Escapes and multiline strings · YourBasic Go
Raw string literals, delimited by backticks (back quotes), are interpreted literally. They can contain line breaks, and backslashes have no special meaning.
Read more >
How to use a JSON document, Utf8JsonReader, and ...
Json doesn't let you disable escaping while writing a string. However, you could pass in your own custom JavaScriptEncoder as an option to...
Read more >
Swift String Cheat Sheet - Use Your Loaf
Custom delimiters become useful when we want to preserve escaped raw text. For example, when creating a String from some JSON.
Read more >
string — CMake 3.25.1 Documentation
JSON string (JSON <out-var> [ERROR_VARIABLE <error-var>] {GET | TYPE ... Escaping a non-special character is unnecessary but allowed, e.g. \a matches a ....
Read more >

github_iconTop Related Medium Post

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