Skip to content

Commit

Permalink
added support for array roots
Browse files Browse the repository at this point in the history
  • Loading branch information
dnet committed Sep 28, 2017
1 parent 81ce883 commit 92dc04a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/burp/JsonJTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ public void actionPerformed(ActionEvent e) {
Part part = comboBox.getItemAt(comboBox.getSelectedIndex());
Json node = Json.read(part.decode());
root.setUserObject(new Node(null, node));
dumpObjectNode(root, node);
if (node.isObject()) {
dumpObjectNode(root, node);
} else if (node.isArray()) {
dumpArrayNode(root, node);
}
model.reload(root);
expandAllNodes(tree, 0, tree.getRowCount());
}
Expand Down Expand Up @@ -173,7 +177,9 @@ public interface Part {

private static void addIfJson(Vector<Part> dest, String value, IParameter param) {
int len = value.length();
if (len >= MIN_LEN && value.charAt(0) == '{' && value.charAt(len - 1) == '}') {
if (len >= MIN_LEN && (
(value.charAt(0) == '{' && value.charAt(len - 1) == '}') ||
(value.charAt(0) == '[' && value.charAt(len - 1) == ']') )) {
dest.add(new Part() {
public String decode() { return value; }

Expand Down Expand Up @@ -224,7 +230,11 @@ public void setMessage(byte[] content, boolean isRequest) {
if (parts.size() == 1) {
Json node = Json.read(parts.get(0).decode());
root.setUserObject(new Node(null, node));
dumpObjectNode(root, node);
if (node.isObject()) {
dumpObjectNode(root, node);
} else if (node.isArray()) {
dumpArrayNode(root, node);
}
comboBox.setVisible(false);
} else {
comboBox.setModel(new DefaultComboBoxModel<>(parts));
Expand Down

0 comments on commit 92dc04a

Please sign in to comment.