add tests for JSONArray and fix some bugs