How to access an array in a JSON object?

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

    Yes, as others have stated, the JSON is actually an Array (of a single Object). So you will need to reference an index.

    Interestingly enough (to me), your result string does validate successfully as JSON. I assumed until now, that to be valid JSON, it had to be an Object (ie, {}).

提交回复
热议问题