I have a JSON string of the following format:
{
\"foo\": \"small_vale\"
\"baz\": \"large_value\"
\"bar\": \"another_large_value\"
}
H
Your json file is not valid. Commas are missing. It should look like this:
{
"foo":"small_value",
"baz":"large_value",
"bar":"another_large_value"
}
This blog post says that Jackson or simple JSON are the fastest ways to parse big json data. Se the chapter "Big File Results" for reference.
Example code for Jackson: Jackson JSON – Read Specific JSON Key
It shows how to parse a json file ang get a value of a specific element.
//read json file data to String
byte[] jsonData = Files.readAllBytes(Paths.get("data.json"));
//create ObjectMapper instance
ObjectMapper objectMapper = new ObjectMapper();
//read JSON like DOM Parser
JsonNode rootNode = objectMapper.readTree(jsonData);
JsonNode fooNode = rootNode.path("foo");
System.out.println("foo value = "+fooNode.asText());