Ensure that JSON parsing returns correct type

Attempting to treat a JSON object as a JSON array should fail, and vice
versa.