Java Code Examples for com.fasterxml.jackson.databind.node.ArrayNode#size()
The following examples show how to use
com.fasterxml.jackson.databind.node.ArrayNode#size() .
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: VpcPeeringConnectionTest.java From batfish with Apache License 2.0 | 6 votes |
@Test public void testDeserialization() throws IOException { String text = readResource("org/batfish/representation/aws/VpcPeeringConnectionsTest.json", UTF_8); JsonNode json = BatfishObjectMapper.mapper().readTree(text); ArrayNode array = (ArrayNode) json.get(JSON_KEY_VPC_PEERING_CONNECTIONS); List<VpcPeeringConnection> vpcPeeringConnections = new LinkedList<>(); for (int index = 0; index < array.size(); index++) { vpcPeeringConnections.add( BatfishObjectMapper.mapper().convertValue(array.get(index), VpcPeeringConnection.class)); } assertThat( vpcPeeringConnections, equalTo( ImmutableList.of( new VpcPeeringConnection( "pcx-f754069e", "vpc-f6c5c790", ImmutableList.of(Prefix.parse("10.199.100.0/24")), "vpc-07acbc61", ImmutableList.of( Prefix.parse("10.130.0.0/16"), Prefix.parse("10.131.0.0/16")))))); }
Example 2
Source File: NetworkAclTest.java From batfish with Apache License 2.0 | 6 votes |
@Test public void testDeserializationV6() throws IOException { String text = readResource("org/batfish/representation/aws/NetworkAclV6Test.json", UTF_8); JsonNode json = BatfishObjectMapper.mapper().readTree(text); ArrayNode array = (ArrayNode) json.get(JSON_KEY_NETWORK_ACLS); List<NetworkAcl> networkAcls = new LinkedList<>(); for (int index = 0; index < array.size(); index++) { networkAcls.add( BatfishObjectMapper.mapper().convertValue(array.get(index), NetworkAcl.class)); } assertThat( networkAcls, equalTo( ImmutableList.of( new NetworkAcl( "acl-4db39c28", "vpc-f8fad69d", ImmutableList.of(new NetworkAclAssociation("subnet-1f315846")), ImmutableList.of( new NetworkAclEntryV6( Prefix6.parse("::/0"), true, true, "-1", 100, null, null)), true)))); }
Example 3
Source File: ProcessInstanceService.java From flowable-engine with Apache License 2.0 | 6 votes |
public List<String> getCurrentActivityInstances(ServerConfig serverConfig, String processInstanceId) { URIBuilder builder = clientUtil.createUriBuilder(MessageFormat.format(CURRENT_ACTIVITY_INSTANCE_LIST_URL, processInstanceId)); HttpGet get = new HttpGet(clientUtil.getServerUrl(serverConfig, builder)); JsonNode node = clientUtil.executeRequest(get, serverConfig); List<String> result = new ArrayList<>(); if (node.isArray()) { ArrayNode data = (ArrayNode) node; for (int i = 0; i < data.size(); i++) { if (data.get(i) != null) { result.add(data.get(i).asText()); } } } return result; }
Example 4
Source File: VpcTest.java From batfish with Apache License 2.0 | 6 votes |
@Test public void testDeserialization() throws IOException { String text = readResource("org/batfish/representation/aws/VpcTest.json", UTF_8); JsonNode json = BatfishObjectMapper.mapper().readTree(text); ArrayNode array = (ArrayNode) json.get(JSON_KEY_VPCS); List<Vpc> vpcs = new LinkedList<>(); for (int index = 0; index < array.size(); index++) { vpcs.add(BatfishObjectMapper.mapper().convertValue(array.get(index), Vpc.class)); } assertThat( vpcs, equalTo( ImmutableList.of( new Vpc( "vpc-CCCCCC", ImmutableSet.of(Prefix.parse("10.100.0.0/16"), Prefix.parse("10.200.0.0/16")), ImmutableMap.of())))); }
Example 5
Source File: ViewObject.java From tasmo with Apache License 2.0 | 6 votes |
private ViewArray processArrayNode(ArrayNode arrayNode) { ViewArray node = new ViewArray(); if (arrayNode.size() != 1) { throw new IllegalArgumentException("Arrays in example view data need to contain one and only one element"); } JsonNode element = arrayNode.get(0); if (element == null || element.isNull()) { throw new IllegalArgumentException("Arrays in example view data cannot contain null elements"); } if (element.isArray()) { throw new IllegalArgumentException("Arrays in example view data cannot be directly nested within other arrays."); } else if (element.isObject()) { node.element = processObjectNode((ObjectNode) element); } return node; }
Example 6
Source File: TagReader.java From smallrye-open-api with Apache License 2.0 | 5 votes |
/** * Reads a list of {@link Tag} OpenAPI nodes. * * @param node the json array node * @return List of Tag models */ public static Optional<List<Tag>> readTags(final JsonNode node) { if (node != null && node.isArray()) { IoLogging.log.jsonArray("Tag"); ArrayNode nodes = (ArrayNode) node; List<Tag> rval = new ArrayList<>(nodes.size()); for (JsonNode tagNode : nodes) { rval.add(readTag(tagNode)); } return Optional.of(rval); } return Optional.empty(); }
Example 7
Source File: WampMessages.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Override public WampMessage fromObjectArray(ArrayNode messageNode) throws WampError { if (messageNode.size() != 2 || !messageNode.get(1).canConvertToLong()) throw new WampError(ApplicationError.INVALID_MESSAGE); long requestId = messageNode.get(1).asLong(); return new UnsubscribedMessage(requestId); }
Example 8
Source File: ModelFieldPathsJSONDeserializer.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
@Override public ModelFieldPaths deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { Set<PathChoice> choices = new HashSet<PathChoice>(); ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); TextNode id = (TextNode)node.get(ID); TextNode name = (TextNode)node.get(NAME); TextNode queryFieldName = (TextNode)node.get(QUERY_FIELD_NAME); // TextNode entity = (TextNode)node.get(ENTITY); ArrayNode choicesJson = (ArrayNode) node.get(CHOICES); if(queryFieldName==null){ throw new JsonProcessingExceptionImpl("Error parsoing the field choices: The "+QUERY_FIELD_NAME+" must be valorized for each field"+node.toString()); } if(choicesJson!=null && id!=null){ for(int i=0; i<choicesJson.size(); i++){ PathChoice pc = deserializePath(choicesJson.get(i)); if(pc!=null){ choices.add(pc); } } IModelField field = modelStructure.getField(id.textValue()); IQueryField qf = getQueryField(queryFieldName.textValue()); if(field==null){ throw new JsonProcessingExceptionImpl("Error parsoing the field choices: can not find the field with id"+name.textValue()+" and name "+id.textValue()+" in the model structure"); } if(qf==null){ return null; //throw new FieldNotAttendInTheQuery("Error parsoing the field choices: can not find the field "+queryFieldName.textValue()+"in the model query"); } return new ModelFieldPaths(qf,field, choices, true); } throw new JsonProcessingExceptionImpl("Can not deserialize the ModelFieldPaths. The mandatory fields are name and paths "+node.toString()); }
Example 9
Source File: WampMessages.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Override public WampMessage fromObjectArray(ArrayNode messageNode) throws WampError { if (messageNode.size() != 3 || !messageNode.get(1).isObject() || !messageNode.get(2).isTextual()) throw new WampError(ApplicationError.INVALID_MESSAGE); ObjectNode details = (ObjectNode) messageNode.get(1); String reason = messageNode.get(2).asText(); return new AbortMessage(details, reason); }
Example 10
Source File: WampMessages.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Override public WampMessage fromObjectArray(ArrayNode messageNode) throws WampError { if (messageNode.size() != 4 || !messageNode.get(1).canConvertToLong() || !messageNode.get(2).isObject() || !messageNode.get(3).isTextual()) throw new WampError(ApplicationError.INVALID_MESSAGE); long requestId = messageNode.get(1).asLong(); ObjectNode options = (ObjectNode) messageNode.get(2); String procedure = messageNode.get(3).asText(); return new RegisterMessage(requestId, options, procedure); }
Example 11
Source File: DataSetAPITest.java From data-prep with Apache License 2.0 | 5 votes |
@Test public void testLookupActionsActions() throws Exception { // given final String firstDataSetId = testClient.createDataset("dataset/dataset.csv", "testDataset"); final String dataSetId = testClient.createDataset("dataset/dataset_cars.csv", "cars"); final String thirdDataSetId = testClient.createDataset("dataset/dataset.csv", "third"); List<String> expectedIds = Arrays.asList(dataSetId, firstDataSetId, thirdDataSetId); // when final String actions = when().get("/api/datasets/{id}/actions", dataSetId).asString(); // then final JsonNode jsonNode = mapper.readTree(actions); // response is an array assertTrue("json not an array:" + actions, jsonNode.isArray()); Assertions.assertThat(jsonNode.isArray()).isTrue(); // an array of 2 entries ArrayNode lookups = (ArrayNode) jsonNode; assertThat(lookups.size(), is(3)); // let's check the url of the possible lookups for (int i = 0; i < lookups.size(); i++) { final JsonNode lookup = lookups.get(i); final ArrayNode parameters = (ArrayNode) lookup.get("parameters"); for (int j = 0; j < parameters.size(); j++) { final JsonNode parameter = parameters.get(j); if (StringUtils.equals(parameter.get("name").asText(), "url")) { final String url = parameter.get("default").asText(); // the url id must be known assertThat(expectedIds.stream().filter(url::contains).count(), is(1L)); } } } }
Example 12
Source File: WampMessages.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Override public WampMessage fromObjectArray(ArrayNode messageNode) throws WampError { if (messageNode.size() != 3 || !messageNode.get(1).isTextual() || !messageNode.get(2).isObject()) throw new WampError(ApplicationError.INVALID_MESSAGE); String signature = messageNode.get(1).asText(); ObjectNode extra = (ObjectNode) messageNode.get(2); return new AuthenticateMessage(signature, extra); }
Example 13
Source File: ElasticsearchJson.java From calcite with Apache License 2.0 | 5 votes |
private static Aggregation parseBuckets(JsonParser parser, String name, ArrayNode nodes) throws JsonProcessingException { List<Bucket> buckets = new ArrayList<>(nodes.size()); for (JsonNode b: nodes) { buckets.add(parseBucket(parser, name, (ObjectNode) b)); } return new MultiBucketsAggregation(name, buckets); }
Example 14
Source File: Version122FinalMigrator.java From apiman with Apache License 2.0 | 5 votes |
/** * @see io.apiman.manager.api.migrator.IVersionMigrator#migrateOrg(com.fasterxml.jackson.databind.node.ObjectNode) */ @Override public void migrateOrg(ObjectNode node) { ArrayNode clients = (ArrayNode) node.get("Clients"); //$NON-NLS-1$ if (clients != null && clients.size() > 0) { for (JsonNode clientNode : clients) { ObjectNode client = (ObjectNode) clientNode; ArrayNode versions = (ArrayNode) client.get("Versions"); //$NON-NLS-1$ if (versions != null && versions.size() > 0) { for (JsonNode versionNode : versions) { ObjectNode version = (ObjectNode) versionNode; ObjectNode clientVersionBean = (ObjectNode) version.get("ClientVersionBean"); //$NON-NLS-1$ clientVersionBean.put("apikey", keyGenerator.generate()); //$NON-NLS-1$ ArrayNode contracts = (ArrayNode) version.get("Contracts"); //$NON-NLS-1$ if (contracts != null && contracts.size() > 0) { for (JsonNode contractNode : contracts) { ObjectNode contract = (ObjectNode) contractNode; contract.remove("apikey"); //$NON-NLS-1$ } } } } } } }
Example 15
Source File: DynamoDBMissionWorker.java From aws-dynamodb-mars-json-demo with Apache License 2.0 | 5 votes |
/** * Retrieves and parses a mission manifest to a map of sol numbers to sol URLs. * * @param url * Location of the mission manifest * @param connectTimeout * Timeout for retrieving the mission manifest * @return Map of sol number to sol URL contained in the mission manifest * @throws IOException * Invalid URL, invalid JSON data, or connection error */ public static Map<Integer, String> getSolJSON(final URL url, final int connectTimeout) throws IOException { final Map<Integer, String> map = new HashMap<Integer, String>(); // Retrieve the JSON data final JsonNode manifest = JSONParser.getJSONFromURL(url, connectTimeout); // Validate the JSON data version if (!manifest.has(RESOURCE_TYPE_KEY) || !SUPPORTED_TYPES.contains(manifest.get(RESOURCE_TYPE_KEY).asText())) { throw new IllegalArgumentException("Manifest version verification failed"); } // Validate that the JSON data contains a sol list if (!manifest.has(SOLS_LIST_KEY)) { throw new IllegalArgumentException("Manifest does not contain a sol list"); } final ArrayNode sols = (ArrayNode) manifest.get(SOLS_LIST_KEY); // Process each sol in the sol list for (int i = 0; i < sols.size(); i++) { final JsonNode sol = sols.path(i); if (sol.has(SOL_ID_KEY) && sol.has(SOL_URL_KEY)) { final Integer solID = sol.get(SOL_ID_KEY).asInt(); final String solURL = sol.get(SOL_URL_KEY).asText(); if (solID != null && solURL != null) { // Add valid sol to the map map.put(solID, solURL); } else { LOGGER.warning("Sol contains unexpected values: " + sol); } } else { LOGGER.warning("Sol missing required keys: "); } } return map; }
Example 16
Source File: SurveyServiceImpl.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Used by the Rest calls to create content. * * Mandatory fields in toolContentJSON: title, instructions, questions. Optional fields are lockWhenFinished * (default true), showOnePage (default true), notifyTeachersOnAnswerSumbit (default false), showOtherUsersAnswers * (default false), reflectOnActivity, reflectInstructions, submissionDeadline * * Questions must contain a ArrayNode of ObjectNode objects, which have the following mandatory fields: * questionText, type (1=one answer,2=multiple answers,3=free text entry) and answers. Answers is a ArrayNode of * strings, which are the answer text. A question may also have the optional fields: allowOtherTextEntry (default * false), required (default true) * * There should be at least one question object in the Questions array and at least one option in the Options array. */ @Override public void createRestToolContent(Integer userID, Long toolContentID, ObjectNode toolContentJSON) { Survey survey = new Survey(); Date updateDate = new Date(); survey.setCreated(updateDate); survey.setUpdated(updateDate); survey.setContentId(toolContentID); survey.setTitle(JsonUtil.optString(toolContentJSON, RestTags.TITLE)); survey.setInstructions(JsonUtil.optString(toolContentJSON, RestTags.INSTRUCTIONS)); survey.setContentInUse(false); survey.setDefineLater(false); survey.setLockWhenFinished(JsonUtil.optBoolean(toolContentJSON, RestTags.LOCK_WHEN_FINISHED, Boolean.TRUE)); survey.setReflectInstructions(JsonUtil.optString(toolContentJSON, RestTags.REFLECT_INSTRUCTIONS)); survey.setReflectOnActivity(JsonUtil.optBoolean(toolContentJSON, RestTags.REFLECT_ON_ACTIVITY, Boolean.FALSE)); survey.setNotifyTeachersOnAnswerSumbit( JsonUtil.optBoolean(toolContentJSON, "notifyTeachersOnAnswerSumbit", Boolean.FALSE)); survey.setShowOnePage(JsonUtil.optBoolean(toolContentJSON, "showOnePage", Boolean.TRUE)); survey.setShowOtherUsersAnswers(JsonUtil.optBoolean(toolContentJSON, "showOtherUsersAnswers", Boolean.FALSE)); // submissionDeadline is set in monitoring SurveyUser surveyUser = new SurveyUser(userID.longValue(), JsonUtil.optString(toolContentJSON, "firstName"), JsonUtil.optString(toolContentJSON, "lastName"), JsonUtil.optString(toolContentJSON, "loginName"), survey); survey.setCreatedBy(surveyUser); // **************************** Handle Survey Questions ********************* ArrayNode questions = JsonUtil.optArray(toolContentJSON, RestTags.QUESTIONS); for (int i = 0; i < questions.size(); i++) { ObjectNode questionData = (ObjectNode) questions.get(i); SurveyQuestion newQuestion = new SurveyQuestion(); newQuestion.setCreateBy(surveyUser); newQuestion.setCreateDate(updateDate); newQuestion.setDescription(JsonUtil.optString(questionData, RestTags.QUESTION_TEXT)); newQuestion.setType((short) questionData.get("type").asInt()); newQuestion.setAppendText(JsonUtil.optBoolean(questionData, "allowOtherTextEntry", Boolean.FALSE)); Boolean required = JsonUtil.optBoolean(questionData, "required", Boolean.TRUE); newQuestion.setOptional(!required); newQuestion.setSequenceId(i + 1); // sequence number starts at 1 Set<SurveyOption> newOptions = new HashSet<>(); ArrayNode options = JsonUtil.optArray(questionData, RestTags.ANSWERS); for (int j = 0; j < options.size(); j++) { SurveyOption newOption = new SurveyOption(); newOption.setDescription(options.get(j).asText()); newOption.setSequenceId(j); // sequence number starts at 0 newOptions.add(newOption); } newQuestion.setOptions(newOptions); survey.getQuestions().add(newQuestion); } saveOrUpdateSurvey(survey); // ******************************* // TODO - investigate conditions // survey.setConditions(conditions); }
Example 17
Source File: JsonQueryObjectModelConverter.java From BIMserver with GNU Affero General Public License v3.0 | 4 votes |
public Query parseJson(String queryName, ObjectNode fullQuery) throws QueryException { Query query = new Query(queryName, packageMetaData); query.setOriginalJson(fullQuery); int version = LATEST_VERSION; if (fullQuery.has("version")) { version = fullQuery.get("version").asInt(); } if (version != LATEST_VERSION) { throw new QueryException("Only version " + LATEST_VERSION + " supported by this version of BIMserver"); } query.setVersion(version); query.setDoubleBuffer(fullQuery.has("doublebuffer") ? fullQuery.get("doublebuffer").asBoolean() : true); if (fullQuery.has("defines")) { JsonNode defines = fullQuery.get("defines"); if (defines instanceof ObjectNode) { parseDefines(query, (ObjectNode)fullQuery.get("defines")); } else { throw new QueryException("\"defines\" must be of type object"); } } if (fullQuery.has("specialQueryType")) { query.setSpecialQueryType(SpecialQueryType.valueOf(fullQuery.get("specialQueryType").asText())); } if (fullQuery.has("loaderSettings")) { query.setGeometrySettings((ObjectNode) fullQuery.get("loaderSettings")); } if (fullQuery.has("queries")) { JsonNode queriesNode = fullQuery.get("queries"); if (queriesNode instanceof ArrayNode) { ArrayNode queries = (ArrayNode) fullQuery.get("queries"); if (queries.size() == 0) { } for (int i=0; i<queries.size(); i++) { parseJsonQuery(query, (ObjectNode)queries.get(i)); } } else { throw new QueryException("\"queries\" must be of type array"); } } else if (fullQuery.has("query")) { JsonNode queryNode = fullQuery.get("query"); if (queryNode instanceof ObjectNode) { parseJsonQuery(query, (ObjectNode) fullQuery.get("query")); } else { throw new QueryException("\"query\" must be of type object"); } } else if (!fullQuery.has("defines")) { parseJsonQuery(query, fullQuery); } return query; }
Example 18
Source File: RemoveIncludesOrExcludesYMLAction.java From walkmod-core with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void doAction(JsonNode node) throws Exception { if (chain == null) { chain = "default"; } if (node.has("chains")) { JsonNode chains = node.get("chains"); if (chains.isArray()) { ArrayNode chainsArray = (ArrayNode) chains; int limit = chainsArray.size(); JsonNode selectedChain = null; for (int i = 0; i < limit && selectedChain == null; i++) { JsonNode chainNode = chainsArray.get(i); if (chainNode.has("name")) { if (chainNode.get("name").asText().equals(chain)) { selectedChain = chainNode; } } } if (selectedChain != null) { if (setToReader) { JsonNode reader = null; if (selectedChain.has("reader")) { reader = selectedChain.get("reader"); } if (reader != null) { removesIncludesOrExcludesList((ObjectNode) reader); } } if (setToWriter) { JsonNode writer = null; if (selectedChain.has("writer")) { writer = selectedChain.get("writer"); } if (writer != null) { removesIncludesOrExcludesList((ObjectNode) writer); } } } } provider.write(node); } }
Example 19
Source File: AddRecordStore.java From constellation with Apache License 2.0 | 4 votes |
@Override public void callService(final PluginParameters parameters, final InputStream in, final OutputStream out) throws IOException { final String graphId = parameters.getStringValue(GRAPH_ID_PARAMETER_ID); final boolean completeWithSchema = parameters.getBooleanValue(COMPLETE_PARAMETER_ID); final String arrange = parameters.getStringValue(ARRANGE_PARAMETER_ID); final boolean resetView = parameters.getBooleanValue(RESET_PARAMETER_ID); final RecordStore rs = new GraphRecordStore(); final ObjectMapper mapper = new ObjectMapper(); final JsonNode json = mapper.readTree(in); // We want to read a JSON document that looks like: // // {"columns":["A","B"],"data":[[1,"a"],[2,"b"],[3,"c"]]} // // which is what is output by pandas.to_json(..., orient="split'). // (We ignore the index array.) if (!json.hasNonNull(COLUMNS) || !json.get(COLUMNS).isArray()) { throw new RestServiceException("Could not find columns object containing column names"); } if (!json.hasNonNull("data") || !json.get("data").isArray()) { throw new RestServiceException("Could not find data object containing data rows"); } final ArrayNode columns = (ArrayNode) json.get(COLUMNS); final String[] headers = new String[columns.size()]; for (int i = 0; i < headers.length; i++) { headers[i] = columns.get(i).asText(); } final ArrayNode data = (ArrayNode) json.get("data"); for (final Iterator<JsonNode> i = data.elements(); i.hasNext();) { final ArrayNode jrow = (ArrayNode) i.next(); rs.add(); boolean txFound = false; boolean txSourceFound = false; for (int ix = 0; ix < headers.length; ix++) { final String h = headers[ix]; final JsonNode jn = jrow.get(ix); if (!jn.isNull()) { if (jn.getNodeType() == JsonNodeType.ARRAY) { rs.set(h, RestServiceUtilities.toList((ArrayNode) jn)); } else { rs.set(h, jn.asText()); } } txFound |= h.startsWith(GraphRecordStoreUtilities.TRANSACTION); txSourceFound |= TX_SOURCE.equals(h); } if (txFound && !txSourceFound) { rs.set(TX_SOURCE, API_SOURCE); } } addToGraph(graphId, rs, completeWithSchema, arrange, resetView); }
Example 20
Source File: AtlasGraphSONUtility.java From incubator-atlas with Apache License 2.0 | 4 votes |
private static Object getValue(Object value, final boolean includeType) { Object returnValue = value; // if the includeType is set to true then show the data types of the properties if (includeType) { // type will be one of: map, list, string, long, int, double, float. // in the event of a complex object it will call a toString and store as a // string String type = determineType(value); ObjectNode valueAndType = JSON_NODE_FACTORY.objectNode(); valueAndType.put(AtlasGraphSONTokens.TYPE, type); if (type.equals(AtlasGraphSONTokens.TYPE_LIST)) { // values of lists must be accumulated as ObjectNode objects under the value key. // will return as a ArrayNode. called recursively to traverse the entire // object graph of each item in the array. ArrayNode list = (ArrayNode) value; // there is a set of values that must be accumulated as an array under a key ArrayNode valueArray = valueAndType.putArray(AtlasGraphSONTokens.VALUE); for (int ix = 0; ix < list.size(); ix++) { // the value of each item in the array is a node object from an ArrayNode...must // get the value of it. addObject(valueArray, getValue(getTypedValueFromJsonNode(list.get(ix)), includeType)); } } else if (type.equals(AtlasGraphSONTokens.TYPE_MAP)) { // maps are converted to a ObjectNode. called recursively to traverse // the entire object graph within the map. ObjectNode convertedMap = JSON_NODE_FACTORY.objectNode(); ObjectNode jsonObject = (ObjectNode) value; Iterator<?> keyIterator = jsonObject.fieldNames(); while (keyIterator.hasNext()) { Object key = keyIterator.next(); // no need to getValue() here as this is already a ObjectNode and should have type info convertedMap.put(key.toString(), jsonObject.get(key.toString())); } valueAndType.put(AtlasGraphSONTokens.VALUE, convertedMap); } else { // this must be a primitive value or a complex object. if a complex // object it will be handled by a call to toString and stored as a // string value putObject(valueAndType, AtlasGraphSONTokens.VALUE, value); } // this goes back as a JSONObject with data type and value returnValue = valueAndType; } return returnValue; }