Gets the String associated with a key @webref jsonobject:method @brief Gets the string value associated with a key @param key a key string @return A string which is the value. @throws RuntimeException if there is no string value for the key. @see JSONObject#getInt(String) @see JSONObject#getFloat(S
(String key)
| 566 | * @see JSONObject#getBoolean(String) |
| 567 | */ |
| 568 | public String getString(String key) { |
| 569 | Object object = this.get(key); |
| 570 | if (object == null) { |
| 571 | // Adding for rev 0257 in line with other p5 api |
| 572 | return null; |
| 573 | } |
| 574 | if (object instanceof String) { |
| 575 | return (String)object; |
| 576 | } |
| 577 | throw new RuntimeException("JSONObject[" + quote(key) + "] is not a string"); |
| 578 | } |
| 579 | |
| 580 | |
| 581 | /** |