sneakyimp wrote:there is no option to force an array for associatively indexed arrays -- which is kind of lame, I think. On the other hand, I'm not an expert in the JSON syntax.
JSON is a subset of JavaScript syntax. JavaScript does not have associatively-indexed arrays (as something distinct from obejcts), therefore neither does JSON (which can be described in about six lines).
This:
[{"month":"Incidents"},{"May":1},{"Apr":64},{"Sep":3},{"Aug":1},{"Mar":66},{"Feb":29}]
Is legitimate JSON. (In other words, the output from [man]json_encode[/man] is ... JSON.)
This:
[["month":"Incidents"],["May":1],["Apr":64],["Sep":3],["Aug":1],["Mar":66],["Feb":29]]
Is not even legitimate JavaScript, let alone legitimate JSON.
From glancing at some of the code examples, I think what the original poster actually wants is
[["month","Incidents"],["May",1],["Apr",64],["Sep",3],["Aug",1],["Mar",66],["Feb",29]]
Which is just an array of arrays - JSON-encoded.