-3

The following is valid. How do I access the data using JSON.parse.

[
    {
        "node_title": "MGP",
        "nid": "4",
        "Album": "Myalbum1",
        "Artist": "Myartist"
    },
    {
        "node_title": "PW",
        "nid": "3",
        "Album": "Myalbum1",
        "Artist": "Myartist"
    }
]
Anik Islam Abhi
  • 25,137
  • 8
  • 58
  • 80
  • The JSON.parse() method parses a string as JSON, optionally transforming the value produced by parsing. How you can retrieve it using this ? – Anik Islam Abhi Oct 29 '14 at 06:33
  • possible duplicate of [How to parse JSON in JavaScript](http://stackoverflow.com/questions/4935632/how-to-parse-json-in-javascript) – Paul Oct 29 '14 at 06:34

1 Answers1

0

Use This

var jsonString= '[
  {"node_title": "MGP", "nid": "4", "Album": "Myalbum1", "Artist": "Myartist"},
  {"node_title": "PW", "nid": "3", "Album": "Myalbum1", "Artist": "Myartist"}
]'

    var jsonFormatVariable = jQuery.parseJSON(jsonString); // in jquery library parse;
 var jsonFormatVariable = JSON.parse(jsonString); // in native js  parse;

console.log(jsonFormatVariable );
Harutyun Abgaryan
  • 2,013
  • 1
  • 12
  • 15