Example usage for com.fasterxml.jackson.databind JsonNode get

List of usage examples for com.fasterxml.jackson.databind JsonNode get

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind JsonNode get.

Prototype

public JsonNode get(String paramString) 

Source Link

Usage

From source file:org.pac4j.oauth.profile.foursquare.FoursquareUserFriends.java

@Override
protected void buildFromJson(JsonNode json) {
    count = json.get("count").asInt();
    ArrayNode groupsArray = (ArrayNode) json.get("groups");

    for (int i = 0; i < groupsArray.size(); i++) {
        FoursquareUserFriendGroup group = new FoursquareUserFriendGroup();
        group.buildFromJson(groupsArray.get(i));
        groups.add(group);/*w ww  .  jav a  2 s  . c om*/
    }
}

From source file:demo.geocoders.MapquestGeocoder.java

@Override
public LatLong geocode(String address) {

    Map<String, String> map = new HashMap<>();
    map.put("key", this.key);
    map.put("location", address);

    ResponseEntity<JsonNode> responseEntity = this.restTemplate.getForEntity(this.urlPath, JsonNode.class, map);
    System.out.println(responseEntity.toString());
    JsonNode jsonNode = responseEntity.getBody();

    if (jsonNode.path("results").size() > 0) {
        JsonNode results = jsonNode.path("results").get(0);
        JsonNode locations = results.path("locations").get(0);
        JsonNode latLng = locations.path("latLng");
        double lng = latLng.get("lng").doubleValue(), lat = latLng.get("lat").doubleValue();
        return new LatLong(lat, lng);
    }//from   w ww  .  j av  a  2 s.c  o  m
    return null;
}

From source file:org.hyperledger.jackson.OutpointDeserializer.java

@Override
public Outpoint deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    JsonNode node = jp.readValueAsTree();
    TID h = new TID(node.get(0).asText());
    int ix = node.get(1).asInt();
    return new Outpoint(h, ix);
}

From source file:managers.relationships.RelManager.java

public Promise<List<JsonNode>> to(LabeledNodeWithProperties endNode) {
    Promise<WS.Response> response = RelationshipService.to(endNode);
    return response.map(new Function<WS.Response, List<JsonNode>>() {
        public List<JsonNode> apply(WS.Response response) {
            JsonNode json = response.asJson();
            return json.get("data").findValues("data");
        }//  ww w.  java2  s  .c  o  m
    });
}

From source file:org.eel.kitchen.jsonschema.syntax.URISyntaxChecker.java

@Override
void checkValue(final Message.Builder msg, final List<Message> messages, final JsonNode schema) {
    final String value = schema.get(keyword).textValue();

    try {/*from   www  .  j  ava  2 s.  c  om*/
        new URI(value);
    } catch (URISyntaxException ignored) {
        msg.setMessage("not a valid URI").addInfo("found", value);
        messages.add(msg.build());
    }
}

From source file:com.redhat.smonkey.RndInt.java

@Override
public JsonNode generate(JsonNodeFactory nodeFactory, JsonNode data, Monkey mon) {
    int min = Utils.asInt(data.get("min"), Integer.MIN_VALUE);
    int max = Utils.asInt(data.get("max"), Integer.MAX_VALUE);
    long x = Utils.rndi(min, max);
    return nodeFactory.numberNode(x);
}

From source file:com.adobe.api.platform.msc.client.jackson.LinkDeserializer.java

@Override
public Link deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {

    ObjectCodec oc = jp.getCodec();//from   www.  j av a 2  s .c  o m
    JsonNode node = oc.readTree(jp);
    return Link.fromUri(node.get("href").asText()).rel(node.get("rel").asText())
            .title(node.get("title").asText()).build();
}

From source file:com.github.fge.jsonschema.keyword.validator.helpers.PositiveIntegerValidator.java

protected PositiveIntegerValidator(final String keyword, final JsonNode digest) {
    super(keyword);
    intValue = digest.get(keyword).intValue();
}

From source file:com.redhat.smonkey.RndLong.java

@Override
public JsonNode generate(JsonNodeFactory nodeFactory, JsonNode data, Monkey mon) {
    long min = Utils.asLong(data.get("min"), Long.MIN_VALUE);
    long max = Utils.asLong(data.get("max"), Long.MAX_VALUE);
    long x = Utils.rndl(min, max);
    return nodeFactory.numberNode(x);
}

From source file:vk.model.VKApiCity.java

/**
 * Fills a City instance from JsonNode./*  www .  j a  v  a2 s  .c o m*/
 */
public VKApiCity parse(JsonNode from) {
    id = from.get("id").asInt();
    title = from.get("title").asText();
    return this;
}