Tuesday, 15 August 2017

JSON Parse Use String Object | JSON To JavaScript - W3tricks

JSON Parse Use String As Object





  • Web server receiving data always as a string. 
  • 'JSON.parse' is used to get JSON data as a string. 
  • Simple syntax.

Syntax

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

Output


0 comments:

Post a Comment