Parsing A Json String In Node Js?
I am trying to send a JSON string and parse it in my server side in node js. I want to extract specific values like title but for some reason I get undefined when I try to parse it
Solution 1:
It looks like you are having an issue because you are using JSON.stringify
on each array element and then using JSON.stringify
on the compiled array.
You should get the expected outcome by stringifying the whole array without stringifying each part. i.e. in your case just stringify the item
$.ajax({
type: 'POST',
url: '/home',
data: JSON.stringify(item),
success: function (data) {
}
Post a Comment for "Parsing A Json String In Node Js?"