MelArlo
MelArlo

Reputation: 157

Can someone please give me a hint as to what is wrong with this JSON?

So I have taken this code to http://pro.jsonlint.com and can't figure out what it is looking for. Here is the code:

[
{
    "subscribers": {
        "id": 4446,
        "full_name": "",
        "email": "",
        "created": "Friday, Dec 13 2013 10:18AM",
        "keyword_id": 305,
        "mobile": 1112223333,
        "facebook": "",
        "zipcode": "",
        "sex": "",
        "age": "",
        "ip": "",
        "list_ids": [
            8,
            12,
            20,
            32,
            50
        ],
        "carrier": "CINGULARUS",
        "opts": 1
    },
    {
        "id": 4428,
        "full_name": "",
        "email": "",
        "created": "Wednesday, Dec 11 2013 3:13PM",
        "keyword_id": 305,
        "mobile": 3332221111,
        "facebook": "",
        "zipcode": "",
        "sex": "",
        "age": "",
        "ip": "",
        "list_ids": [
            8,
            20,
            32,
            50
        ],
        "carrier": "CINGULARUS",
        "opts": 1
    }
}
]

...and here is the error: http://screencloud.net/v/bnl4

Any help would be appreciated. :)

Upvotes: 0

Views: 49

Answers (3)

memodev07
memodev07

Reputation: 1

Why are you creating 2 independent objects with same key? Why don't you create an object with an array of subscribers objects? like this:

{
"subscribers": [
    {
        "id": 4446,
        "full_name": "",
        "email": "",
        "created": "Friday, Dec13201310: 18AM",
        "keyword_id": 305,
        "mobile": 1112223333,
        "facebook": "",
        "zipcode": "",
        "sex": "",
        "age": "",
        "ip": "",
        "list_ids": [
            8,
            12,
            20,
            32,
            50
        ],
        "carrier": "CINGULARUS",
        "opts": 1
    },
    {
        "id": 4428,
        "full_name": "",
        "email": "",
        "created": "Wednesday, Dec1120133: 13PM",
        "keyword_id": 305,
        "mobile": 3332221111,
        "facebook": "",
        "zipcode": "",
        "sex": "",
        "age": "",
        "ip": "",
        "list_ids": [
            8,
            20,
            32,
            50
        ],
        "carrier": "CINGULARUS",
        "opts": 1
    }
]

}

Upvotes: 0

Mark Giaconia
Mark Giaconia

Reputation: 3953

if subscribers is an array, try this

[
    {
        "subscribers": [
            {
                "id": 4446,
                "full_name": "",
                "email": "",
                "created": "Friday, Dec 13 2013 10:18AM",
                "keyword_id": 305,
                "mobile": 1112223333,
                "facebook": "",
                "zipcode": "",
                "sex": "",
                "age": "",
                "ip": "",
                "list_ids": [
                    8,
                    12,
                    20,
                    32,
                    50
                ],
                "carrier": "CINGULARUS",
                "opts": 1
            },
            {
                "id": 4428,
                "full_name": "",
                "email": "",
                "created": "Wednesday, Dec 11 2013 3:13PM",
                "keyword_id": 305,
                "mobile": 3332221111,
                "facebook": "",
                "zipcode": "",
                "sex": "",
                "age": "",
                "ip": "",
                "list_ids": [
                    8,
                    20,
                    32,
                    50
                ],
                "carrier": "CINGULARUS",
                "opts": 1
            }
        ]
    }
]

Upvotes: 2

kei
kei

Reputation: 20521

You're missing "subscribers":

[
    {
        "subscribers": {
            "id": 4446,
            "full_name": "",
            "email": "",
            "created": "Friday, Dec 13 2013 10:18AM",
            "keyword_id": 305,
            "mobile": 1112223333,
            "facebook": "",
            "zipcode": "",
            "sex": "",
            "age": "",
            "ip": "",
            "list_ids": [
                8,
                12,
                20,
                32,
                50
            ],
            "carrier": "CINGULARUS",
            "opts": 1
        },
        "subscribers": {
            "id": 4428,
            "full_name": "",
            "email": "",
            "created": "Wednesday, Dec 11 2013 3:13PM",
            "keyword_id": 305,
            "mobile": 3332221111,
            "facebook": "",
            "zipcode": "",
            "sex": "",
            "age": "",
            "ip": "",
            "list_ids": [
                8,
                20,
                32,
                50
            ],
            "carrier": "CINGULARUS",
            "opts": 1
        }
    }
]

OR you haven't wrapped the value of subscribers properly (using [] ):

[
    {
        "subscribers": [
            {
                "id": 4446,
                "full_name": "",
                "email": "",
                "created": "Friday, Dec 13 2013 10:18AM",
                "keyword_id": 305,
                "mobile": 1112223333,
                "facebook": "",
                "zipcode": "",
                "sex": "",
                "age": "",
                "ip": "",
                "list_ids": [
                    8,
                    12,
                    20,
                    32,
                    50
                ],
                "carrier": "CINGULARUS",
                "opts": 1
            },
            {
                "id": 4428,
                "full_name": "",
                "email": "",
                "created": "Wednesday, Dec 11 2013 3:13PM",
                "keyword_id": 305,
                "mobile": 3332221111,
                "facebook": "",
                "zipcode": "",
                "sex": "",
                "age": "",
                "ip": "",
                "list_ids": [
                    8,
                    20,
                    32,
                    50
                ],
                "carrier": "CINGULARUS",
                "opts": 1
            }
        ]
    }
]

Upvotes: 2

Related Questions