Try enclosing the whole structure into an array ref, and don't forget commas!
[ { "_id" : 0, "name" : "Betty Boop", "subjects" : [ { "type" : "optional", "subject" : "Voice"}, { "type" : "required", "subject" : "Math" }, { "type" : "required", "subject" : "English" } ] }, { "_id" : 1, "name" : "Donald Duck", "subjects" : [ { "type" : "optional", "subject" : "Accounting" }, { "type" : "required", "subject" : "Math" }, { "type" : "required", "subject" : "English" } ] } ]
By the way, here is a utility i use to help debug JSON files:
alias djson='perl -MData::Dumper -MJSON -MFile::Slurp -e"print Dumper +decode_json read_file shift"'
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: reading JSON
by jeffa
in thread reading JSON
by FryingFinn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |