List of usage examples for com.fasterxml.jackson.core JsonToken START_OBJECT
JsonToken START_OBJECT
To view the source code for com.fasterxml.jackson.core JsonToken START_OBJECT.
Click Source Link
From source file:org.talend.dataprep.api.dataset.DataSetDataReader.java
private Map<String, Map<String, String>> parseRecords(JsonParser jsonParser, RowMetadata rowMetadata, String joinOnColumn) throws IOException { try {/*from w ww . j a v a 2 s . c o m*/ JsonToken firstToken = jsonParser.nextToken(); // Read to array first element Validate.isTrue(firstToken == JsonToken.START_OBJECT, INCORRECT_OBJECT_STRUCTURE_ERROR_MESSAGE); Map<String, Map<String, String>> lookupDataset = new HashMap<>(); Iterator<Map<String, String>> mapIterator = jsonParser .readValuesAs(new TypeReference<Map<String, String>>() { }); while (mapIterator.hasNext()) { Map<String, String> recordMap = mapIterator.next(); lookupDataset.put(recordMap.get(joinOnColumn), recordMap); } Validate.isTrue(!lookupDataset.isEmpty(), "No lookup record has been retrieved when trying to parse the retrieved data set."); return lookupDataset; } catch (IOException e) { throw new IOException("Unable to parse and retrieve the records of the data set", e); } }