Skip to content

Commit

Permalink
Added something avoid unpacking some arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
cgueret committed Dec 22, 2012
1 parent 2b9aa30 commit 6dc51a5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/IDSWrapper/src/uk/ac/ids/util/DataHarvester.java
Expand Up @@ -89,9 +89,19 @@ private void parseElement(String root, JsonElement element,

else if (element.isJsonArray()) {
JsonArray array = element.getAsJsonArray();

// Look if there is any complex element in the array
boolean complex = false;
for (int i = 0; i < array.size(); i++)
if (!array.get(i).isJsonPrimitive())
complex = true;

for (int i = 0; i < array.size(); i++) {
JsonElement v = array.get(i);
String newRoot = root + i + ".";
if (!complex) {
newRoot = root;
}
parseElement(newRoot, v, results);
}
}
Expand Down

0 comments on commit 6dc51a5

Please sign in to comment.