Skip to content

Commit

Permalink
fix: Output all contents in tree output (fixes #104)
Browse files Browse the repository at this point in the history
fixed array handling, changed output from ascii to unicode style, cleanup
  • Loading branch information
psmf22 authored Jul 21, 2023
1 parent 0a3de1b commit f4f4f81
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ private static void treeBuilder(SimpleTreeNode treeNode, JsonNode inputNode){
case NUMBER:
case STRING:
case BOOLEAN:
addPrimitiveChildNode(treeNode, inputNode.asText());
break;
addPrimitiveChildNode(treeNode, inputNode.asText());
break;
case OBJECT:
addObjectChildNode(treeNode, inputNode);
break;
Expand All @@ -56,14 +56,14 @@ private static void treeBuilder(SimpleTreeNode treeNode, JsonNode inputNode){
treeBuilder(treeNode, n);
}
break;
default:
break;
default:
break;
}

}

private static void addPrimitiveChildNode(SimpleTreeNode treeNode, String text) {
SimpleTreeNode childNode = new SimpleTreeNode( text );
SimpleTreeNode childNode = new SimpleTreeNode( text );
treeNode.addChild(childNode);
}

Expand All @@ -72,11 +72,11 @@ private static void addObjectChildNode(SimpleTreeNode treeNode, JsonNode inputNo
for (Iterator<Map.Entry<String, JsonNode>> it = inputNode.fields(); it.hasNext(); ) {
Map.Entry<String, JsonNode> n = it.next();
if(n.getValue().isContainerNode()) {
SimpleTreeNode childNode = new SimpleTreeNode(n.getKey());
SimpleTreeNode childNode = new SimpleTreeNode(n.getKey());
treeBuilder(childNode, n.getValue());
treeNode.addChild(childNode);
} else {
addPrimitiveChildNode(treeNode, n.getKey() + ": " + n.getValue().asText());
addPrimitiveChildNode(treeNode, n.getKey() + ": " + n.getValue().asText());
}
}
}
Expand Down

0 comments on commit f4f4f81

Please sign in to comment.