Get the JSONArray value associated with a key. @webref jsonobject:method @brief Gets the JSONArray value associated with a key @param key a key string @return A JSONArray which is the value, or null if not present @throws RuntimeException if the value is not a JSONArray. @see JSONObject#getJSONObje
(String key)
| 795 | * @see JSONObject#setJSONArray(String, JSONArray) |
| 796 | */ |
| 797 | public JSONArray getJSONArray(String key) { |
| 798 | Object object = this.get(key); |
| 799 | if (object == null) { |
| 800 | return null; |
| 801 | } |
| 802 | if (object instanceof JSONArray) { |
| 803 | return (JSONArray)object; |
| 804 | } |
| 805 | throw new RuntimeException("JSONObject[" + quote(key) + "] is not a JSONArray."); |
| 806 | } |
| 807 | |
| 808 | |
| 809 | /** |