How to access an array in a JSON object?

后端 未结 8 1002
感动是毒
感动是毒 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:24

    the JSON you have coming back is actually an array itself, so...

    dataJS[0].comments[0].created_at
    

    will be 2011-02-09T14:42:42-08:00, etc...

    Both dataJS and comments are arrays, and need indexes to access the appropriate elements.

提交回复
热议问题