Produce a JSONArray containing the names of the elements of this JSONObject. @return A JSONArray containing the key strings, or null if the JSONObject is empty.
()
| 713 | * is empty. |
| 714 | */ |
| 715 | public JSONArray names() { |
| 716 | JSONArray ja = new JSONArray(); |
| 717 | Iterator keys = keys(); |
| 718 | while (keys.hasNext()) { |
| 719 | ja.put(keys.next()); |
| 720 | } |
| 721 | return ja.length() == 0 ? null : ja; |
| 722 | } |
| 723 | |
| 724 | /** |
| 725 | * Produce a string from a Number. |