Serializes the given object to a JSON string @param object The object to serialize @return A JSON formatted string @throws IllegalArgumentException if the object was null @throws JSONException if the object could not be serialized
(final Object object)
| 271 | * @throws JSONException if the object could not be serialized |
| 272 | */ |
| 273 | public static final String serializeToString(final Object object) { |
| 274 | if (object == null) |
| 275 | throw new IllegalArgumentException("Object was null"); |
| 276 | try { |
| 277 | return jsonMapper.writeValueAsString(object); |
| 278 | } catch (JsonProcessingException e) { |
| 279 | throw new JSONException(e); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * Serializes the given object to a JSON byte array |
no outgoing calls