How to access an array in a JSON object?

后端 未结 8 1001
感动是毒
感动是毒 2020-12-15 05:35

I have the following JSON object:

[
    {
        "comments": [
            {
                "created_at": "2011-02-09T14:42:42-08:0         


        
8条回答
  •  臣服心动
    2020-12-15 06:02

    Do something like this:-

    var dataJS = [{"comments":[{"created_at":"2011-02-09T14:42:42-08:00","thumb":"xxxxxxx","level":1,"id":214,"user_id":41,"parent_id":213,"content":"

    xxxxxx

    ","full_name":"xx K"},{"created_at":"2011-02-09T14:41:23-08:00","thumb":"xxxxxxxxxxxxx","level":0,"id":213,"user_id":19,"parent_id":null,"content":"

    this is another test

    ","full_name":"asd asd asd asd asd"}],"eee1":"asdadsdas","eee2":"bbbbb"}]; var created_at = dataJS[0].comments[0].created_at;

提交回复
热议问题