-1

我有一个很大的 json 文件,它的结构有点像 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}]

在我第一次从 json 读取数据之前,我只是为 json 树提供了一些值,我不知道如何读取它,请给我一些提示

4

1 回答 1

3

在 jQuery 中,您可以通过使用读取 json$.parseJSON

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

使用时$.parseJSON,不要错过在 json 的根中插入单引号 (') 或双引号 (")。

示例此处带有 json 数组

这是一个 JSON 验证器。http://jsonlint.com/

于 2012-04-20T04:12:21.277 回答