Fix mis-matched endObject() in JSON generation.