public Result runBoon() { String result = null; String error = null; long time; Iterator<Object> query = null; long now = System.currentTimeMillis(); try { if (!optionAsValues) { throw new UnsupportedOperationException("Not supported!"); } io.gatling.jsonpath.JsonPath jsonPath = JsonPath$.MODULE$.compile(path).right().get(); JsonParser jsonParser = new JsonParserCharArray(); Object jsonModel = jsonParser.parse(json); query = jsonPath.query(jsonModel); } catch (Exception e) { error = getError(e); } finally { time = System.currentTimeMillis() - now; if (query != null) { List<Object> res = new ArrayList<Object>(); while (query.hasNext()) { res.add(query.next()); } ObjectMapper mapper = new ObjectMapperImpl(); result = mapper.toJson(res); } return new Result("boon", time, result, error); } }
/** * Parse a JSON data structure from content from a reader * * @param reader reader over a JSON content * @return a data structure of lists and maps */ public Object parse(Reader reader) { return new JsonParserUsingCharacterSource ( ).parse ( reader ); }
@Override public Object parse ( final char[] chars ) { __index = 0; charArray = chars; lastIndex = chars.length -1; Object value = decodeValue(); return value; }
@Override public <T> List<T> parseList ( Class<T> componentType, byte[] jsonBytes ) { List<Object> list = parse ( List.class, jsonBytes ); return convertList( componentType, list ); }
public JsonParserAndMapper createParserWithEvents(JsonParserEvents events) { BaseJsonParserAndMapper jsonParser = new BaseJsonParserAndMapper( new JsonParserLax ( false, chop, lazyChop, false, events ), createMapper() ); jsonParser.setCharset ( charset ); return jsonParser; }
public JsonParserAndMapper createUTF8DirectByteParser() { BaseJsonParserAndMapper jsonParser = new BaseJsonParserAndMapper( new JsonUTF8Parser ( ), createMapper() ); jsonParser.setCharset ( StandardCharsets.UTF_8 ); return jsonParser; }
public JsonParserAndMapper createFastObjectMapperParser() { BaseJsonParserAndMapper jsonParser = new BaseJsonParserAndMapper( new JsonFastParser ( true ), createMapper()); jsonParser.setCharset ( charset ); return jsonParser; }
public JsonParserAndMapper createJsonCharArrayParser() { BaseJsonParserAndMapper jsonParser = new BaseJsonParserAndMapper( new JsonParserCharArray( ), createMapper()); jsonParser.setCharset ( charset ); return jsonParser; }
public JsonParserAndMapper createASCIIParser() { BaseJsonParserAndMapper jsonParser = new BaseJsonParserAndMapper( new JsonAsciiParser ( ), createMapper() ); jsonParser.setCharset ( StandardCharsets.US_ASCII ); return jsonParser; }
@Override public <T> List<T> parseList ( Class<T> componentType, Reader reader ) { List<Object> list = parse ( List.class, reader ); return convertList( componentType, list ); }
public JsonParserAndMapper createLaxParser() { BaseJsonParserAndMapper jsonParser = new BaseJsonParserAndMapper( new JsonParserLax ( false, chop, lazyChop, checkDates ), createMapper()); jsonParser.setCharset ( charset ); return jsonParser; }
public JsonParserAndMapper createUTF8DirectByteParser() { BaseJsonParserAndMapper jsonParser = new BaseJsonParserAndMapper( new JsonUTF8Parser ( ), createMapper() ); jsonParser.setCharset ( StandardCharsets.UTF_8 ); return jsonParser; }
/** * Parse a JSON data structure from content from a reader * * @param reader reader over a JSON content * @return a data structure of lists and maps */ public Object parse(Reader reader) { return new JsonParserUsingCharacterSource ( ).parse ( reader ); }
@Override public <T> List<T> parseList ( Class<T> componentType, InputStream input, Charset charset ) { List<Object> list = parse ( List.class, input, charset ); return convertList( componentType, list ); }
@Override public <T> List<T> parseList ( Class<T> componentType, String jsonString ) { List<Object> list = parse ( List.class, jsonString ); return convertList( componentType, list ); }
@Override public <T> List<T> parseList ( Class<T> componentType, byte[] jsonBytes, Charset charset ) { List<Object> list = parse ( List.class, jsonBytes, charset ); return convertList( componentType, list ); }
@Override public <T> List<T> parseList ( Class<T> componentType, CharSequence jsonSeq ) { List<Object> list = parse ( List.class, jsonSeq ); return convertList( componentType, list ); }
@Override public <T> List<T> parseList ( Class<T> componentType, String jsonString ) { List<Object> list = parse ( List.class, jsonString ); return convertList( componentType, list ); }
@Override public <T> List<T> parseList ( Class<T> componentType, InputStream input ) { List<Object> list = parse ( List.class, input ); return convertList( componentType, list ); }
@Override public <T> List<T> parseList ( Class<T> componentType, char[] chars ) { List<Object> list = parse ( List.class, chars ); return convertList( componentType, list ); }