I have a string "{\"id\":\"35112914\"}"
obtained after JSON.stringify
.
I want just the number 35112914
or the first instance of a number ,i.e. 3
to the last ,i.e., 4
. Is there any other way of approaching this ?
Edit:
I had to stringify because of a weird error I was getting. While accessing the property of the object, i was getting undefined
as the answer , which made the number inaccessible. Stringify atleast shows up the number .
Edit 2 :
My code is written in node which makes curl request to a REST api .
curl.request(optionsRun, function (error, response) {
console.log(response);
setTimeout(function () {
ID = response ;
console.log(ID["id"]) ;
},2000) ;
}) ;
Output:
{"id":"35113281"}
undefined