Make a JSON text of this JSONObject. For compactness, no whitespace is added. If this would not result in a syntactically correct JSON text, then null will be returned instead. Warning: This method assumes that the data structure is acyclical. @return a printable, displayable, portable, transmi
()
| 1334 | * with <code>}</code> <small>(right brace)</small>. |
| 1335 | */ |
| 1336 | @Override |
| 1337 | public String toString() { |
| 1338 | try { |
| 1339 | Iterator keys = keys(); |
| 1340 | StringBuffer sb = new StringBuffer("{"); |
| 1341 | |
| 1342 | while (keys.hasNext()) { |
| 1343 | if (sb.length() > 1) { |
| 1344 | sb.append(','); |
| 1345 | } |
| 1346 | Object o = keys.next(); |
| 1347 | sb.append(quote(o.toString())); |
| 1348 | sb.append(':'); |
| 1349 | sb.append(valueToString(this.map.get(o))); |
| 1350 | } |
| 1351 | sb.append('}'); |
| 1352 | return sb.toString(); |
| 1353 | } catch (Exception e) { |
| 1354 | return null; |
| 1355 | } |
| 1356 | } |
| 1357 | |
| 1358 | |
| 1359 | /** |
no test coverage detected