Exception using JSON.decode

I'm getting this exception when using JSON.decode in Dart. Any ideas as to how to resolve this?

message: Class 'List' has no instance method 'codeUnitAt'.

Here is the JSON data it's trying to decode:

[{_index: supply-desc-index, _type: supply-desc, _id: AVWeP5ZymMsGSnzRy9Kg, _score: 0.37158427, _source: {name: Test 3, description: test bdrwf, uom: EA, ipn: 1412341, mpn: 1234124, fireBaseKey: {description: test bdrwf, ipn: 1412341, mpn: 1234124, name: Test 3, uom: EA}}}, {_index: supply-desc-index, _type: supply-desc, _id: AVWeQ_56mMsGSnzRy9NG, _score: 0.37158427, _source: {name: Test, description: test 524, uom: EA, ipn: 42141, mpn: 124124, fireBaseKey: {description: test 524, ipn: 42141, mpn: 124124, name: Test, uom: EA}}}, {_index: supply-desc-index, _type: supply-desc, _id: 1, _score: 0.19178301, _source: {name: Test 3, description: test bdrwf, uom: EA, ipn: 1412341, mpn: 1234124, fireBaseKey: {description: test bdrwf, ipn: 1412341, mpn: 1234124, name: Test 3, uom: EA}}}, {_index: supply-desc-index, _type: supply-desc, _id: AVWeP6FsmMsGSnzRy9Kh, _score: 0.19178301, _source: {name: Test 3, description: test bdrwf, uom: EA, ipn: 1412341, mpn: 1234124, fireBaseKey: {description: test bdrwf, ipn: 1412341, mpn: 1234124, name: Test 3, uom: EA}}}]

Upvotes: 0

Views: 156

Answers (1)

Argenti Apparatus
Argenti Apparatus

Reputation: 4013

One problem is that the data you gave - if we take it literally - is not valid JSON (it is valid YAML however.)

If all the keys and values were quoted then it would be valid JSON.

(Validated by pasting your data into jsonlint.com and yamllint.com).

Where's that data coming from?

Upvotes: 2

Related Questions