javascript - Difference between JSON.stringify and JSON.parse -


i have been confused on when use these 2 parsing methods.

after echo json_encoded data , retrieve via ajax, run confusion when should use json.stringify , json.parse.

i [object,object] in console.log when parsed , javascript object when stringified.

$.ajax({ url: "demo_test.txt", success: function(data) {          console.log(json.stringify(data))                      /* or */          console.log(json.parse(data))         //this unsure about?     } }); 

json.stringify turns javascript object json text , stores json text in string.

json.parse turns string of json text javascript object.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -