Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectMapper.configure()


      locateAddressGET = new GetMethod(locationFindURL);
      int httpRetCode = client.executeMethod(locateAddressGET);
      if(httpRetCode == HttpStatus.SC_OK){
          String responseBodyAsString = locateAddressGET.getResponseBodyAsString();
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
        mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
        mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
        JsonNode jsonRoot = mapper.readTree(responseBodyAsString);
        JsonNode location = jsonRoot.path("results").get(0).path("geometry").path("location");
        JsonNode lat = location.get("lat");
View Full Code Here


      int httpRetCode = client.executeMethod(locateAddressGET);
      if(httpRetCode == HttpStatus.SC_OK){
          String responseBodyAsString = locateAddressGET.getResponseBodyAsString();
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
        mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
        mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
        JsonNode jsonRoot = mapper.readTree(responseBodyAsString);
        JsonNode location = jsonRoot.path("results").get(0).path("geometry").path("location");
        JsonNode lat = location.get("lat");
        JsonNode lng = location.get("lng");
View Full Code Here

      if(httpRetCode == HttpStatus.SC_OK){
          String responseBodyAsString = locateAddressGET.getResponseBodyAsString();
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
        mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
        mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
        JsonNode jsonRoot = mapper.readTree(responseBodyAsString);
        JsonNode location = jsonRoot.path("results").get(0).path("geometry").path("location");
        JsonNode lat = location.get("lat");
        JsonNode lng = location.get("lng");
        coordinates = new LatLng(lat.asDouble(),lng.asDouble());
View Full Code Here

        return jsReference.get();
      }
    }

    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, false);
    Map<String, Object> modelObject = new LinkedHashMap<String, Object>();
    modelObject.put("extend", "Ext.data.Model");

    if (!model.getAssociations().isEmpty()) {
      Set<String> usesClasses = new HashSet<String>();
View Full Code Here

    }

    public static ObjectMapper createDefaultMapper() {
        final ObjectMapper result = new ObjectMapper();
        result.setSerializationInclusion(Include.NON_NULL);
        result.configure(SerializationFeature.INDENT_OUTPUT, false);
        result.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        result.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);

        SimpleModule module = new SimpleModule();
        module.addDeserializer(Money.class, new MoneyDeserializer());
View Full Code Here

    public static ObjectMapper createDefaultMapper() {
        final ObjectMapper result = new ObjectMapper();
        result.setSerializationInclusion(Include.NON_NULL);
        result.configure(SerializationFeature.INDENT_OUTPUT, false);
        result.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        result.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);

        SimpleModule module = new SimpleModule();
        module.addDeserializer(Money.class, new MoneyDeserializer());
        module.addDeserializer(CurrencyUnit.class, new CurrencyUnitDeserializer());
View Full Code Here

         * @throws java.io.IOException
         */
        public static Metadata fromJsonString(String metadata, boolean allowSingleQuotes) throws IOException {

            ObjectMapper metadataObjectMapper = new ObjectMapper();
            metadataObjectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);

            JsonNode metadataRootNode = metadataObjectMapper.readTree(metadata);

            return fromJson(metadataRootNode);
        }
View Full Code Here

         * @throws java.io.IOException
         */
        public static Metadata fromJsonString(String metadata, boolean allowSingleQuotes) throws IOException {

            ObjectMapper metadataObjectMapper = new ObjectMapper();
            metadataObjectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);

            JsonNode metadataRootNode = metadataObjectMapper.readTree(metadata);

            return fromJson(metadataRootNode);
        }
View Full Code Here

    inputStream = AtlasAccountInfoTest.class.getResourceAsStream("/account/accountInfo.json");
    if (inputStream == null) {
      LOGGER.error("Could not Load test data.");
    }
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
    try {
      accountInfo = mapper.readValue(inputStream, AtlasAccountInfo.class);
    } catch (Exception e) {
      LOGGER.error(e.getMessage());
    }
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = OpenOrdersJSONTest.class.getResourceAsStream("/v2/trade/example-openorders-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    ANXOpenOrder[] anxOpenOrders = mapper.readValue(is, ANXOpenOrder[].class);

    // System.out.println(new Date(anxOpenOrders[0].getDate()));

    // Verify that the example data was unmarshalled correctly
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.