Provided that you have already read this object into JsonNode, you can do it like this:
String content = jsonNode.get("data").textValue();
UPD: since you're using a streaming parser, this example on Jackson usage might help.
UPD: the method name is now textValue() - docs
When we try to fetch data in form of string from JsonNode,we usually use asText, but we should use textValue instead.
asText: Method that will return a valid String representation of the container value, if the node is a value node (method isValueNode() returns true), otherwise empty String.
textValue: Method to use for accessing String values. Does NOT do any conversions for non-String value nodes; for non-String values (ones for which isTextual() returns false) null will be returned. For String values, null is never returned (but empty Strings may be)
So Let's take an example,
JsonNode getJsonData(){
ObjectMapper mapper = new ObjectMapper();
ObjectNode node = mapper.createObjectNode();
node.put("anyParameter",null);
return node;
}
JsonNode node = getJsonData();
json.get("anyParameter").asText() // this will give output as "null"
json.get("").textValue() // this will give output as null