I am bit new to javascript and I want to change a particular JSON element to string without changing the whole JSON.
Input:
{
"Response" : {
"Data" : {
"Type" : "Set",
"Serial" : "75798"
}
}
}
The output I wanted is:
{
"Response" : {
"Data" : {
"Type" : "Set",
"Serial" : 75798
}
}
}
Got to know about parseInt function but not sure how to write the full code where I get the output as above after it processed by the javascript.
JSON.stringifyandJSON.parseconvert an object to a string and a string to an object respectively. As for changing the property, just doResponse.Data.Serial = parseInt(Response.Data.Serial)