-2

I have a big json file it's structure is somewhat like json

- Lessons
    [{ "1 ":
         { " name ": "abc" ,
           " number ":"123" ,
            "check ":
             { "name ":"abc1" ,
               " quizes" :
                [ { "Questions " :
                     [ { "questiontype ": "your name" ,
                      "questionstem " : "name"
                     " options " :
                        [{ answer : "1",
                         ident : "left",
                         feedback : "yes" , 
                         answer: "no",
                         ident : "yes",
                         feedback : "yes"}
                        { answer
                         ident
                         feedback } 
                       {  answer
                         ident
                         feedback }]
                     correct_answers }}
                 Questions 
                 Questions 
                 Questions 
                 Questions 
                 Questions 
                 Questions 
                 Questions 
                 Questions 
                 Questions ]
         practise
         show
             name
             quizes }
     2 
     3}]

Above I am just providing tree of json with some value before this is first time I am reading data from json I don't have any idea how to read it plz give me some hints

3
  • 3
    google.co.in/… Commented Apr 20, 2012 at 4:01
  • 1
    This is not a correct Json, plz correct your JSON using jsonlint.com Commented Apr 20, 2012 at 4:11
  • this is nor original json i got file it's just copy of that tree Commented Apr 20, 2012 at 4:17

1 Answer 1

3

In jQuery you can read json by use $.parseJSON

​var jsonData = '{"a" : "22"}';
$.parseJSON(jsonData)

When use $.parseJSON, don't miss to insert Single Quote (') or Double Quote (") in the root of json.

Example and Here with json array

And here is a JSON Validator. http://jsonlint.com/

Sign up to request clarification or add additional context in comments.

4 Comments

but hoe can I fetch the data inside it
From my Example you can use json.a to get the number 22.
function parsejson(){ $.getJSON("0132549840.json",function(data){ console.log("Hello"); $.each(data, function(key,value){ }); }); } I tried to did this but I am not able to ptint console statement is their any thing wrong
Look like you have to use $.ajax This post has the same problem. stackoverflow.com/questions/6002325/getjson-not-working

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.