List of usage examples for com.fasterxml.jackson.databind JsonNode get
public JsonNode get(String paramString)
From source file:com.github.fge.jsonschema.keyword.validator.common.EnumValidator.java
public EnumValidator(final JsonNode digest) { super("enum"); values = digest.get(keyword); }
From source file:com.yahoo.elide.contrib.swagger.SwaggerIT.java
@Test void testDocumentFetch() throws Exception { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(RestAssured.get("/doc/test").asString()); Assert.assertNotNull(node.get("paths").get("/book")); }
From source file:org.enotron.simulator.utility.JsonHexStringToByteArray.java
@Override public byte[] deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode node = jp.getCodec().readTree(jp); String hexString = ((TextNode) node.get("simulatorUid")).asText(); return ByteArrayHelper.fromHexString(hexString); }
From source file:com.flipkart.zjsonpatch.AbstractTest.java
private void testOpertaion() throws Exception { JsonNode node = p.getNode(); JsonNode first = node.get("node"); JsonNode second = node.get("expected"); JsonNode patch = node.get("op"); String message = node.has("message") ? node.get("message").toString() : ""; JsonNode secondPrime = JsonPatch.apply(patch, first); assertThat(message, secondPrime, equalTo(second)); }
From source file:org.jsfr.json.BenchmarkParseLargeJsonWithoutStreaming.java
@Benchmark public void benchmarkRawJackson(Blackhole blackhole) throws IOException { JsonNode node = om.readTree(json); Iterator<JsonNode> iterator = node.get("builders").elements(); while (iterator.hasNext()) { JsonNode value = iterator.next().get("properties").get("branch"); LOGGER.trace("json element: {}", value); blackhole.consume(value);//from w w w . j av a2s . com } }
From source file:com.flipkart.zjsonpatch.AbstractTest.java
private void testError() { JsonNode node = p.getNode(); JsonNode first = node.get("node"); JsonNode patch = node.get("op"); try {/*www. j av a 2 s . c om*/ JsonPatch.apply(patch, first); fail("Failure expected: " + node.get("message")); } catch (Exception ex) { } }
From source file:com.ibm.watson.catalyst.corpus.tfidf.term.Term.java
public Term(JsonNode aNode) { _term = aNode.get("string").asText(); _frequency = aNode.get("frequency").asInt(); _idf = aNode.get("tfidf").asDouble(); }
From source file:io.gravitee.definition.jackson.datatype.api.deser.AbstractStdScalarDeserializer.java
protected String readStringValue(JsonNode rootNode, String fieldName, String defaultValue) { JsonNode fieldNode = rootNode.get(fieldName); if (fieldNode != null) { return fieldNode.asText(); }//from www . j a v a 2 s. c om return defaultValue; }
From source file:managers.nodes.ValueManager.java
private Promise<Boolean> orphaned(JsonNode properties) { Value value = new Value(properties.get("name").asText()); return super.orphaned(value, Allows.relationships); }
From source file:org.agorava.twitter.jackson.SimilarPlacesDeserializer.java
@Override public SimilarPlacesResponse deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectMapper mapper = BeanResolver.getInstance().resolve(ObjectMapper.class); jp.setCodec(mapper);// w ww . j av a 2 s . c o m JsonNode node = jp.readValueAs(JsonNode.class); JsonNode resultNode = node.get("result"); String token = resultNode.get("token").textValue(); JsonNode placesNode = resultNode.get("places"); @SuppressWarnings("unchecked") List<Place> places = (List<Place>) mapper.reader(new TypeReference<List<Place>>() { }).readValue(placesNode); return new SimilarPlacesResponse(places, token); }