When the stringified string is sent to request directly, it is not getting added any slashes.
var data = { "A": "Aa", "B": "Bb", "C": "Cc" }; // This is JSON object
data = JSON.stringify(data); // Getting stringified
var obj = {method: "POST",
url: 'http://..XX..XXX.....com',
data: data // String is being sent as it is
};
$http(obj);// Have no slashes added
//Output: {"A":"Aa","B":"Bb","C":"Cc"}
But if the stringified string is set value as property of object and object is sent to server, the string is having backslashes.
var data = { "A": "Aa", "B": "Bb", "C": "Cc" };
data = JSON.stringify(data);
var obj = {method: "POST",
url: 'XXX',
data: { // String is being sent as a value of object property "Values"
"Values": data
}
};
$http(obj);//Slashes are added
//output: {"Values":"{\"A\":\"Aa\",\"B\":\"Bb\",\"C\":\"Cc\"}"}
Can somebody take a look once?