Convert an object to JSON text. @see JSONObject#toJSONString(Map) @see JSONArray#toJSONString(List) @return JSON text, or "null" if value is null or it's an NaN or an INF number.
(Object value)
| 162 | * number. |
| 163 | */ |
| 164 | public static String toJSONString(Object value) { |
| 165 | Writer w = new StringWriter(); |
| 166 | |
| 167 | try { |
| 168 | writeJSONString(value, w); |
| 169 | } |
| 170 | catch (IOException ignore) {} |
| 171 | |
| 172 | return w.toString(); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters |
no test coverage detected