Tuesday, 15 August 2017

How to JSON Stringify Turn Into a String Value - W3tricks

JSON Stringify Turn Into a String Value


JSON.stringify convert a Javascript object into a JSON text.

Syntax

  • var student = '{"student1" : {"name" : "Bob", "age" : "18", "city" : "new york"}, "student2": {"name" : "Alice", "age" : "16", "city" : "paris"}}';
  • var str = JSON.parse(student);
  • var str_value = JSON.stringify(str);
  • console.log(str_value);

Output


0 comments:

Post a Comment