mituw16 mituw16 - 1 year ago 143
JSON Question

Invalid JSON String Parsing

It's really early east coast time, and I can't for the life of me see why this JSON string is invalid.. Does anyone else see anything? (I've been looking at this for about 30 minutes now doing the old head meet desk routine)

'Subsidiaries': [{
'SubsidiaryID': '4',
'Level': 'Division'
'SubsidiaryID': '3',
'Level': 'Subsidiary'

Answer Source

If your current parser does not offer enough information, you can use a JSON validator to find out the exact details. There're even on-line ones like JSONLint:

Error: Parse error on line 1:
{ 'Subsidiaries': [{  
Expecting 'STRING', '}', got 'undefined'

So it's clear that 'Subsidiaries' is not a valid string and the validator points you the exact character that's invalid. You have the wrong quotes (remember that JSON is not JavaScript).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download