Parses a JSON formatted string into raw tokens for streaming or tree iteration Warning: This method can parse an invalid JSON object without throwing an error until you start processing the data @param json The string to parse @return A JsonParser object to be used for iteration @throws Illeg
(final String json)
| 208 | * @throws JSONException if the data could not be parsed |
| 209 | */ |
| 210 | public static final JsonParser parseToStream(final String json) { |
| 211 | if (json == null || json.isEmpty()) |
| 212 | throw new IllegalArgumentException("Incoming data was null or empty"); |
| 213 | try { |
| 214 | return jsonMapper.getFactory().createJsonParser(json); |
| 215 | } catch (JsonParseException e) { |
| 216 | throw new IllegalArgumentException(e); |
| 217 | } catch (IOException e) { |
| 218 | throw new JSONException(e); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * Parses a JSON formatted byte array into raw tokens for streaming or tree |