Reputation: 1212
I have written a native android module where i am returning Json string to JavaScript layer. But in javascript layer , i am getting this json string added with "\" for all "". How to escape this "\" from json string.
Upvotes: 2
Views: 132
Reputation: 4738
Seems that your json
is not a "real JSON object" but just a String. This explain why "
symbol are escaped. Try to use JSON.parse()
in your javascript.
var my_json_string = "{\"my_key\": \"the_value\"}";
var my_json_object = JSON.parse(my_json_string);
// should render something like
// Object {my_key: "the_value"}
Upvotes: 2