JSONString return backslashes
See original GitHub issueI’m trying to use graphene JSONString to query/mutate a django jsonfield, but in the both cases I receive/send this:
{
"data": {
"TitleType": [
{
"id": "1",
"name": "My First Title",
"fields": "{\"a\": \"b\"}"
}
]
}
}
can you guys tell me how can I avoid the backslashes in both cases?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Return Json, but it includes backward slashes "\", which I don't ...
Most likely, the slashes are an artifact because you copied them out of the VisualStudio debugger. The debugger displays all strings in a...
Read more >JSON returning backslashes - MSDN - Microsoft
Hi i have the following which returns json, however it is returning data with backslashes. public string getUserInfo(string UserID) { Users ...
Read more >How to remove backslash from json data in C#? - CodeProject
The answer is simple: there is no backslash in the string! What you're seeing is the Visual Studio debugger's representation of the string....
Read more >Remove back slash from response - Salesforce Developers
To remove the backslash you have to write the blob value of the JSON String into the body directly in the RestContext. You...
Read more >Best Json Escape Characters, Double Quotes and Backslash ...
Backspace is replaced with \b, Form feed is replaced with \f, Newline is replaced with \n, Carriage return is replaced with \r, Tab...
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
from graphene.types.generic import GenericScalar
You can’t avoid backlashes because that how JSON strings look. According to JSON spec, JSON values have to use double quotes - " So if you have a JSON value inside a a string value that’s in a JSON, you cant use the inner " chars will break the outer JSON, you have to backslash them.
An alternative would be to use
GenericScalar
instead ofJSONString
. In that case your value will be returned as a JSON object and not a string, like this: