private NodeAndFormat getNodeAndFormat(final String path) {
JsonNode jsonNode = this.jsonNode;
final List<String> keys = PathNode.split(path);
String format = null;
for (final String key : keys) {
final PathNode pathNode = PathNode.parse(key);
if (!pathNode.getKey().isEmpty()) {
// grab format (if present) before moving down the path
format = getFormatValueIfAnyFrom(jsonNode);
jsonNode = jsonNode.path(pathNode.getKey());
} else {
// pathNode is criteria only; don't change jsonNode
}
if (jsonNode.isNull()) {
return new NodeAndFormat(jsonNode, format);
}
if (!pathNode.hasCriteria()) {
continue;
}
if (!jsonNode.isArray()) {
return new NodeAndFormat(NullNode.getInstance(), format);
}