org.codehaus.jackson.JsonParser Java Examples
The following examples show how to use
org.codehaus.jackson.JsonParser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HiveJsonStructReader.java From incubator-hivemall with Apache License 2.0 | 6 votes |
private Object parsePrimitive(JsonParser parser, PrimitiveObjectInspector oi) throws SerDeException, IOException { JsonToken currentToken = parser.getCurrentToken(); if (currentToken == null) { return null; } try { switch (parser.getCurrentToken()) { case VALUE_FALSE: case VALUE_TRUE: case VALUE_NUMBER_INT: case VALUE_NUMBER_FLOAT: case VALUE_STRING: return getObjectOfCorrespondingPrimitiveType(parser.getText(), oi); case VALUE_NULL: return null; default: throw new SerDeException("unexpected token type: " + currentToken); } } finally { parser.nextToken(); } }
Example #2
Source File: AbstractJsonDeserializer.java From urule with Apache License 2.0 | 6 votes |
private void buildScoreRule(JsonParser jsonParser,JsonNode ruleNode,ScoreRule rule){ rule.setScoringBean(JsonUtils.getJsonValue(ruleNode, "scoringBean")); AssignTargetType assignTargetType=AssignTargetType.valueOf(JsonUtils.getJsonValue(ruleNode, "assignTargetType")); rule.setAssignTargetType(assignTargetType); rule.setVariableCategory(JsonUtils.getJsonValue(ruleNode, "variableCategory")); rule.setVariableName(JsonUtils.getJsonValue(ruleNode, "variableName")); rule.setVariableLabel(JsonUtils.getJsonValue(ruleNode, "variableLabel")); String datatypeStr=JsonUtils.getJsonValue(ruleNode, "datatype"); if(StringUtils.isNotBlank(datatypeStr)){ rule.setDatatype(Datatype.valueOf(datatypeStr)); } try{ JsonNode knowledgePackageWrapperNode=ruleNode.get("knowledgePackageWrapper"); ObjectMapper mapper = (ObjectMapper)jsonParser.getCodec(); KnowledgePackageWrapper wrapper=mapper.readValue(knowledgePackageWrapperNode, KnowledgePackageWrapper.class); wrapper.buildDeserialize(); rule.setKnowledgePackageWrapper(wrapper); }catch(Exception ex){ throw new RuleException(ex); } }
Example #3
Source File: StateDeserializer.java From hadoop with Apache License 2.0 | 6 votes |
@Override public StatePair deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectMapper mapper = (ObjectMapper) parser.getCodec(); // set the state-pair object tree ObjectNode statePairObject = (ObjectNode) mapper.readTree(parser); Class<?> stateClass = null; try { stateClass = Class.forName(statePairObject.get("className").getTextValue().trim()); } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Invalid classname!", cnfe); } String stateJsonString = statePairObject.get("state").toString(); State state = (State) mapper.readValue(stateJsonString, stateClass); return new StatePair(state); }
Example #4
Source File: JacksonJsonParser.java From elasticsearch-hadoop with Apache License 2.0 | 6 votes |
private NumberType convertNumberType(JsonParser.NumberType numberType) { switch (numberType) { case INT: return NumberType.INT; case LONG: return NumberType.LONG; case FLOAT: return NumberType.FLOAT; case DOUBLE: return NumberType.DOUBLE; case BIG_INTEGER: return NumberType.DOUBLE; case BIG_DECIMAL: return NumberType.DOUBLE; } throw new EsHadoopSerializationException("No matching token for number_type [" + numberType + "]"); }
Example #5
Source File: StatePool.java From hadoop with Apache License 2.0 | 6 votes |
private void read(DataInput in) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure( DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true); // define a module SimpleModule module = new SimpleModule("State Serializer", new Version(0, 1, 1, "FINAL")); // add the state deserializer module.addDeserializer(StatePair.class, new StateDeserializer()); // register the module with the object-mapper mapper.registerModule(module); JsonParser parser = mapper.getJsonFactory().createJsonParser((DataInputStream)in); StatePool statePool = mapper.readValue(parser, StatePool.class); this.setStates(statePool.getStates()); parser.close(); }
Example #6
Source File: EventResource.java From io with Apache License 2.0 | 6 votes |
/** * リクエストボディを解析してEventオブジェクトを取得する. * @param reader Http入力ストリーム * @return 解析したEventオブジェクト */ protected JSONEvent getRequestBody(final Reader reader) { JSONEvent event = null; JsonParser jp = null; ObjectMapper mapper = new ObjectMapper(); JsonFactory f = new JsonFactory(); try { jp = f.createJsonParser(reader); JsonToken token = jp.nextToken(); // JSONルート要素("{") if (token == JsonToken.START_OBJECT) { event = mapper.readValue(jp, JSONEvent.class); } else { throw DcCoreException.Event.JSON_PARSE_ERROR; } } catch (IOException e) { throw DcCoreException.Event.JSON_PARSE_ERROR; } return event; }
Example #7
Source File: BarFileUtils.java From io with Apache License 2.0 | 6 votes |
/** * barファイルエントリからJSONファイルを読み込む. * @param <T> JSONMappedObject * @param inStream barファイルエントリのInputStream * @param entryName entryName * @param clazz clazz * @return JSONファイルから読み込んだオブジェクト * @throws IOException JSONファイル読み込みエラー */ public static <T> T readJsonEntry( InputStream inStream, String entryName, Class<T> clazz) throws IOException { JsonParser jp = null; ObjectMapper mapper = new ObjectMapper(); JsonFactory f = new JsonFactory(); jp = f.createJsonParser(inStream); JsonToken token = jp.nextToken(); // JSONルート要素("{") Pattern formatPattern = Pattern.compile(".*/+(.*)"); Matcher formatMatcher = formatPattern.matcher(entryName); String jsonName = formatMatcher.replaceAll("$1"); T json = null; if (token == JsonToken.START_OBJECT) { try { json = mapper.readValue(jp, clazz); } catch (UnrecognizedPropertyException ex) { throw DcCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName); } } else { throw DcCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName); } return json; }
Example #8
Source File: BackportedJacksonMappingIterator.java From elasticsearch-hadoop with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") protected BackportedJacksonMappingIterator(JavaType type, JsonParser jp, DeserializationContext ctxt, JsonDeserializer<?> deser) { _type = type; _parser = jp; _context = ctxt; _deserializer = (JsonDeserializer<T>) deser; /* One more thing: if we are at START_ARRAY (but NOT root-level * one!), advance to next token (to allow matching END_ARRAY) */ if (jp != null && jp.getCurrentToken() == JsonToken.START_ARRAY) { JsonStreamContext sc = jp.getParsingContext(); // safest way to skip current token is to clear it (so we'll advance soon) if (!sc.inRoot()) { jp.clearCurrentToken(); } } }
Example #9
Source File: JSONManifestTest.java From io with Apache License 2.0 | 6 votes |
/** * manifest.jsonのschema値がURL形式である場合trueが返却されること. * @throws IOException IOException */ @SuppressWarnings("unchecked") @Test public void manifest_jsonのschema値がURL形式である場合trueが返却されること() throws IOException { JsonFactory f = new JsonFactory(); JSONObject json = new JSONObject(); json.put("bar_version", "1"); json.put("box_version", "1"); json.put("DefaultPath", "boxName"); json.put("schema", "http://app1.example.com/"); JsonParser jp = f.createJsonParser(json.toJSONString()); ObjectMapper mapper = new ObjectMapper(); jp.nextToken(); JSONManifest manifest = mapper.readValue(jp, JSONManifest.class); assertTrue(manifest.checkSchema()); }
Example #10
Source File: HelloWorldIT.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testJsonRoundtrip() throws Exception { List<Object> providers = new ArrayList<>(); providers.add(new org.codehaus.jackson.jaxrs.JacksonJsonProvider()); JsonBean inputBean = new JsonBean(); inputBean.setVal1("Maple"); WebClient client = WebClient.create(endpointUrl + "/hello/jsonBean", providers); Response r = client.accept("application/json") .type("application/json") .post(inputBean); assertEquals(Response.Status.OK.getStatusCode(), r.getStatus()); MappingJsonFactory factory = new MappingJsonFactory(); JsonParser parser = factory.createJsonParser((InputStream)r.getEntity()); JsonBean output = parser.readValueAs(JsonBean.class); assertEquals("Maple", output.getVal2()); }
Example #11
Source File: TaggerServiceImpl.java From AIDR with GNU Affero General Public License v3.0 | 6 votes |
private int getCurrentRetrainingThreshold() throws Exception { try { String retrainingThreshold = this.getRetainingThreshold(); ObjectMapper mapper = JacksonWrapper.getObjectMapper(); JsonFactory factory = mapper.getJsonFactory(); // since 2.1 use // mapper.getFactory() // instead JsonParser jp = factory.createJsonParser(retrainingThreshold); JsonNode actualObj = mapper.readTree(jp); JsonNode nameNode = actualObj.get("sampleCountThreshold"); int sampleCountThreshold = Integer.parseInt(nameNode.asText()); return sampleCountThreshold; } catch (Exception e) { logger.error("Exception while getting CurrentRetrainingThreshold", e); return 50; } }
Example #12
Source File: QueryReportProcessor.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 6 votes |
private com.esri.core.geometry.Geometry constructGeometry(com.esri.ges.spatial.Geometry geo) throws Exception { try{ String jsonIn = geo.toJson(); JsonFactory jf = new JsonFactory(); JsonParser jp = jf.createJsonParser(jsonIn); MapGeometry mgeo = GeometryEngine.jsonToGeometry(jp); com.esri.core.geometry.Geometry geoIn= mgeo.getGeometry(); return GeometryEngine.project(geoIn, srIn, srBuffer); } catch(Exception e) { LOG.error(e.getMessage()); LOG.error(e.getStackTrace()); throw(e); } }
Example #13
Source File: CustomJsonDateDeserializer.java From jeecg with Apache License 2.0 | 6 votes |
@Override public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String text = jp.getText(); if (StringUtils.hasText(text)) { try { if (text.indexOf(":") == -1 && text.length() == 10) { return this.dateFormat.parse(text); } else if (text.indexOf(":") > 0 && text.length() == 19) { return this.datetimeFormat.parse(text); } else { throw new IllegalArgumentException("Could not parse date, date format is error "); } } catch (ParseException ex) { IllegalArgumentException iae = new IllegalArgumentException("Could not parse date: " + ex.getMessage()); iae.initCause(ex); throw iae; } } else { return null; } }
Example #14
Source File: StateDeserializer.java From big-c with Apache License 2.0 | 6 votes |
@Override public StatePair deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectMapper mapper = (ObjectMapper) parser.getCodec(); // set the state-pair object tree ObjectNode statePairObject = (ObjectNode) mapper.readTree(parser); Class<?> stateClass = null; try { stateClass = Class.forName(statePairObject.get("className").getTextValue().trim()); } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Invalid classname!", cnfe); } String stateJsonString = statePairObject.get("state").toString(); State state = (State) mapper.readValue(stateJsonString, stateClass); return new StatePair(state); }
Example #15
Source File: JsonSerdeUtils.java From incubator-hivemall with Apache License 2.0 | 6 votes |
@Nonnull private static List<Object> parseArray(@Nonnull final JsonParser p, @CheckForNull final List<TypeInfo> columnTypes) throws HCatException, IOException, SerDeException { Preconditions.checkNotNull(columnTypes, "columnTypes MUST NOT be null", SerDeException.class); if (columnTypes.size() != 1) { throw new IOException("Expected a single array but go " + columnTypes); } TypeInfo elemType = columnTypes.get(0); HCatSchema schema = HCatSchemaUtils.getHCatSchema(elemType); HCatFieldSchema listSchema = schema.get(0); HCatFieldSchema elemSchema = listSchema.getArrayElementSchema().get(0); final List<Object> arr = new ArrayList<Object>(); while (p.nextToken() != JsonToken.END_ARRAY) { arr.add(extractCurrentField(p, elemSchema, true)); } return arr; }
Example #16
Source File: JsonSerdeUtils.java From incubator-hivemall with Apache License 2.0 | 6 votes |
@Nonnull private static Object parseValue(@Nonnull final JsonParser p) throws JsonParseException, IOException { final JsonToken t = p.getCurrentToken(); switch (t) { case VALUE_FALSE: return Boolean.FALSE; case VALUE_TRUE: return Boolean.TRUE; case VALUE_NULL: return null; case VALUE_STRING: return p.getText(); case VALUE_NUMBER_FLOAT: return p.getDoubleValue(); case VALUE_NUMBER_INT: return p.getIntValue(); default: throw new IOException("Unexpected token: " + t); } }
Example #17
Source File: JsonUpdateWebServer.java From jwala with Apache License 2.0 | 6 votes |
@Override public JsonUpdateWebServer deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final ObjectCodec obj = jp.getCodec(); final JsonNode node = obj.readTree(jp).get(0); final Set<String> groupIds = deserializeGroupIdentifiers(node); return new JsonUpdateWebServer(node.get("webserverId").getValueAsText(), node.get("webserverName").getTextValue(), node.get("hostName").getTextValue(), node.get("portNumber").getValueAsText(), node.get("httpsPort").getValueAsText(), groupIds, node.get("statusPath").getTextValue(), node.get("apacheHttpdMediaId").getTextValue()); }
Example #18
Source File: BarFileValidateTest.java From io with Apache License 2.0 | 6 votes |
/** * box_versionを指定しない場合に例外がスローされる. */ @Test @SuppressWarnings({"unchecked" }) public void box_versionを指定しない場合に例外がスローされる() { JsonFactory f = new JsonFactory(); JSONObject json = new JSONObject(); json.put("bar_version", "1"); json.put("DefaultPath", "boxName"); json.put("schema", "http://app1.example.com"); try { JsonParser jp = f.createJsonParser(json.toJSONString()); ObjectMapper mapper = new ObjectMapper(); jp.nextToken(); TestBarRunner testBarRunner = new TestBarRunner(); testBarRunner.manifestJsonValidate(jp, mapper); } catch (DcCoreException dce) { assertEquals(400, dce.getStatus()); assertEquals("PR400-BI-0006", dce.getCode()); return; } catch (Exception ex) { fail("Unexpected exception"); } fail("DcCoreExceptionが返却されない"); }
Example #19
Source File: JsonUtils.java From binlake with Apache License 2.0 | 6 votes |
public static JsonNode parseJson(String json) throws Exception { ObjectMapper mapper = new ObjectMapper(); JsonFactory f = new MappingJsonFactory(); JsonParser jp = null; JsonNode rootNode = null; try { jp = f.createJsonParser(json); rootNode = mapper.readTree(jp); } catch (Exception e) { throw e; } finally { if (jp != null) jp.close(); } return rootNode; }
Example #20
Source File: HiveJsonStructReader.java From incubator-hivemall with Apache License 2.0 | 6 votes |
private static void skipValue(JsonParser parser) throws JsonParseException, IOException { int array = 0; int object = 0; do { JsonToken currentToken = parser.getCurrentToken(); if (currentToken == JsonToken.START_ARRAY) { array++; } if (currentToken == JsonToken.END_ARRAY) { array--; } if (currentToken == JsonToken.START_OBJECT) { object++; } if (currentToken == JsonToken.END_OBJECT) { object--; } parser.nextToken(); } while (array > 0 || object > 0); }
Example #21
Source File: BarFileValidateTest.java From io with Apache License 2.0 | 6 votes |
/** * DefaultPathを指定しない場合に例外がスローされる. */ @Test @SuppressWarnings({"unchecked" }) public void DefaultPathを指定しない場合に例外がスローされる() { JsonFactory f = new JsonFactory(); JSONObject json = new JSONObject(); json.put("bar_version", "1"); json.put("box_version", "1"); json.put("schema", "http://app1.example.com"); try { JsonParser jp = f.createJsonParser(json.toJSONString()); ObjectMapper mapper = new ObjectMapper(); jp.nextToken(); TestBarRunner testBarRunner = new TestBarRunner(); testBarRunner.manifestJsonValidate(jp, mapper); } catch (DcCoreException dce) { assertEquals(400, dce.getStatus()); assertEquals("PR400-BI-0006", dce.getCode()); return; } catch (Exception ex) { fail("Unexpected exception"); } fail("DcCoreExceptionが返却されない"); }
Example #22
Source File: ContainerPlacementMessageObjectMapper.java From samza with Apache License 2.0 | 5 votes |
@Override public ContainerPlacementMessage deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); String subType = node.get("subType").getTextValue(); String deploymentId = node.get("deploymentId").getTextValue(); String processorId = node.get("processorId").getTextValue(); String destinationHost = node.get("destinationHost").getTextValue(); long timestamp = node.get("timestamp").getLongValue(); Duration requestExpiry = node.get("requestExpiry") == null ? null : Duration.ofMillis(node.get("requestExpiry").getLongValue()); ContainerPlacementMessage.StatusCode statusCode = null; UUID uuid = UUID.fromString(node.get("uuid").getTextValue()); for (ContainerPlacementMessage.StatusCode code : ContainerPlacementMessage.StatusCode.values()) { if (code.name().equals(node.get("statusCode").getTextValue())) { statusCode = code; } } ContainerPlacementMessage message = null; if (subType.equals(ContainerPlacementRequestMessage.class.getSimpleName())) { message = new ContainerPlacementRequestMessage(uuid, deploymentId, processorId, destinationHost, requestExpiry, timestamp); } else if (subType.equals(ContainerPlacementResponseMessage.class.getSimpleName())) { String responseMessage = node.get("responseMessage").getTextValue(); message = new ContainerPlacementResponseMessage(uuid, deploymentId, processorId, destinationHost, requestExpiry, statusCode, responseMessage, timestamp); } return message; }
Example #23
Source File: BarFileValidateTest.java From io with Apache License 2.0 | 5 votes |
/** * 正しいJSONデータを与えてJSONmanifestオブジェクトが返却される. */ @Test @SuppressWarnings({"unchecked" }) public void 正しいJSONデータを与えてJSONManifestオブジェクトが返却される() { JsonFactory f = new JsonFactory(); JSONObject json = new JSONObject(); json.put("bar_version", "1"); json.put("box_version", "1"); json.put("DefaultPath", "boxName"); json.put("schema", "http://app1.example.com"); try { JsonParser jp = f.createJsonParser(json.toJSONString()); ObjectMapper mapper = new ObjectMapper(); jp.nextToken(); TestBarRunner testBarRunner = new TestBarRunner(); JSONManifest manifest = testBarRunner.manifestJsonValidate(jp, mapper); assertNotNull(manifest); assertEquals("1", manifest.getBarVersion()); assertEquals("1", manifest.getBoxVersion()); assertEquals("boxName", manifest.getDefaultPath()); assertEquals("http://app1.example.com", manifest.getSchema()); } catch (IOException e) { fail(e.getMessage()); } }
Example #24
Source File: JSONValidator.java From scheduling with GNU Affero General Public License v3.0 | 5 votes |
@Override public String validate(String parameterValue, ModelValidatorContext context) throws ValidationException { try { final JsonParser parser = new ObjectMapper().getJsonFactory().createJsonParser(parameterValue); while (parser.nextToken() != null) { } } catch (Exception jpe) { throw new ValidationException("Invalid JSON: " + jpe.getMessage(), jpe); } return parameterValue; }
Example #25
Source File: JsonDateDeSerializer.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Override public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String date = jp.getText(); if(date!= null && !date.equals("")){ try { return dateFormat.parse(date); } catch (ParseException e) { logger.error("ParfseException for the date:"+date,e); throw new RuntimeException(e); } } return null; }
Example #26
Source File: JacksonObjectMapperWithOptions.java From secure-data-service with Apache License 2.0 | 5 votes |
public JacksonObjectMapperWithOptions() { super(); this.getJsonFactory().setCharacterEscapes(new HTMLCharacterEscapes()); configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); configure(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true); configure(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, true); setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(JsonAutoDetect.Visibility.ANY)); }
Example #27
Source File: BarFileValidateTest.java From io with Apache License 2.0 | 5 votes |
/** * DefaultPathにnullを指定した場合に例外がスローされる. */ @Test @SuppressWarnings({"unchecked" }) public void DefaultPathにnullを指定した場合に例外がスローされる() { JsonFactory f = new JsonFactory(); JSONObject json = new JSONObject(); json.put("bar_version", "1"); json.put("box_version", "1"); json.put("DefaultPath", null); json.put("schema", "http://app1.example.com"); try { JsonParser jp = f.createJsonParser(json.toJSONString()); ObjectMapper mapper = new ObjectMapper(); jp.nextToken(); TestBarRunner testBarRunner = new TestBarRunner(); testBarRunner.manifestJsonValidate(jp, mapper); } catch (DcCoreException dce) { assertEquals(400, dce.getStatus()); assertEquals("PR400-BI-0006", dce.getCode()); return; } catch (Exception ex) { fail("Unexpected exception"); } fail("DcCoreExceptionが返却されない"); }
Example #28
Source File: BarFileValidateTest.java From io with Apache License 2.0 | 5 votes |
/** * schemaを指定しない場合にJSONManifestオブジェクトが返却される. */ @Test @SuppressWarnings({"unchecked" }) public void schemaを指定しない場合にJSONManifestオブジェクトが返却される() { JsonFactory f = new JsonFactory(); JSONObject json = new JSONObject(); json.put("bar_version", "1"); json.put("box_version", "1"); json.put("DefaultPath", "boxName"); try { JsonParser jp = f.createJsonParser(json.toJSONString()); ObjectMapper mapper = new ObjectMapper(); jp.nextToken(); TestBarRunner testBarRunner = new TestBarRunner(); JSONManifest manifest = testBarRunner.manifestJsonValidate(jp, mapper); assertNotNull(manifest); assertEquals("1", manifest.getBarVersion()); assertEquals("1", manifest.getBoxVersion()); assertEquals("boxName", manifest.getDefaultPath()); assertNull(manifest.getSchema()); } catch (IOException e) { fail(e.getMessage()); } }
Example #29
Source File: PartitionDefinitionTest.java From elasticsearch-hadoop with Apache License 2.0 | 5 votes |
private Mapping getTestMapping() throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonParser jsonParser = mapper.getJsonFactory() .createJsonParser(getClass().getResourceAsStream("/org/elasticsearch/hadoop/serialization/dto/mapping/typeless/basic.json")); Map<String, Object> map = (Map<String, Object>) mapper.readValue(jsonParser, Map.class); return FieldParser.parseTypelessMappings(map).getResolvedView(); }
Example #30
Source File: GeoDynamoDBServlet.java From reinvent2013-mobile-photo-share with Apache License 2.0 | 5 votes |
private void printGetPointRequest(GetPointResult getPointResult, PrintWriter out) throws JsonParseException, IOException { Map<String, AttributeValue> item = getPointResult.getGetItemResult().getItem(); String geoJsonString = item.get(config.getGeoJsonAttributeName()).getS(); JsonParser jsonParser = factory.createJsonParser(geoJsonString); JsonNode jsonNode = mapper.readTree(jsonParser); double latitude = jsonNode.get("coordinates").get(0).getDoubleValue(); double longitude = jsonNode.get("coordinates").get(1).getDoubleValue(); String hashKey = item.get(config.getHashKeyAttributeName()).getN(); String rangeKey = item.get(config.getRangeKeyAttributeName()).getS(); String geohash = item.get(config.getGeohashAttributeName()).getN(); String title = item.get("title").getS(); String userId = item.get("userId").getS(); Map<String, String> resultMap = new HashMap<String, String>(); resultMap.put("latitude", Double.toString(latitude)); resultMap.put("longitude", Double.toString(longitude)); resultMap.put("hashKey", hashKey); resultMap.put("rangeKey", rangeKey); resultMap.put("geohash", geohash); resultMap.put("title", title); resultMap.put("userId", userId); Map<String, Object> jsonMap = new HashMap<String, Object>(); jsonMap.put("action", "get-point"); jsonMap.put("result", resultMap); out.println(mapper.writeValueAsString(jsonMap)); out.flush(); }