Return Json, But It Includes Backward Slashes "\", Which I Don't Want

Return Json, but it includes backward slashes “\”,

Why are you returning a json string from your web api?

It knows how to serialize objects into JSON's automatically.

Anyway to convert a string json into a json use JSON.parse:

var json = "{\"cid\":1,\"model\":\"WT50JB\",\"detail\":\"sdf??\",\"unit\":2,\"time_in\":\"2012-12-11T19:00:00\",\"time_out\":\"2012-12-12T13:00:06.2774691+07:00\",\"time_used_dd\":0.0,\"time_used_hh\":0.0}";
var parsedJSON = JSON.parse(json);

alert(parsedJSON.cid); // 1

How to remove backslash on json_encode() function?

json_encode($response, JSON_UNESCAPED_SLASHES);

Remove Backslashes from Json Data in JavaScript

Your string is invalid, but assuming it was valid, you'd have to do:

var finalData = str.replace(/\\/g, "");

When you want to replace all the occurences with .replace, the first parameter must be a regex, if you supply a string, only the first occurrence will be replaced, that's why your replace wouldn't work.


Remove back slash from Json String in android

The command


is correct and if you try to display the server response with an online json formatter ( you can clearly see that the string is not correctly formatted. The double quotes after the "response" and one at the end are not required.

How to remove or prevent escape slashes from json-file data in azure logic app workflow

You just need to replace the \" with " by the expression below:

replace(string(body('Get_blob_content')), '\"', '"')

And then we can use json() to convert it.


In your json data to insert to table storage, the data in red box below cause the problem
enter image description here

You can't insert into it with the second level of data.

Remove back slashes from JSON response

You just need to deserialize the body.