07-22-2019 04:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-22-2019 04:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
var test = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
console.log('testing parsing', test);
i have used this sample josn to parse but i am unable to parse.
Can anyone help me to get it right.
Thanks in advance

07-22-2019 06:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-22-2019 06:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
What is the error?

07-22-2019 06:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-22-2019 06:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I get [object] [object] when i parse the response

07-22-2019 06:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-22-2019 06:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
thats because it is an object. you need to specify what exactly you want to see.
try
console.log('testing parsing', test.name);

07-22-2019 13:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


07-22-2019 13:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
...or you could try console.log(JSON.stringify(test)) if you don't mind going around in a circle. 🙂
I'm also not convinced that " are beneficial around object attribute names; eg, for "name".
Gondwana Software

07-23-2019 05:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-23-2019 05:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you so much for your input.
As you said that is object.

