Guest User

Untitled

a guest
Feb 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. public static void iterateJacksonJsonNode(JsonNode node) {
  2.  
  3. if (node.getNodeType() == JsonNodeType.ARRAY) {
  4. for (final JsonNode arrayChildNodes : node) {
  5. analyseJSONNames(arrayChildNodes);
  6. }
  7. } else {
  8.  
  9. Iterator<Map.Entry<String, JsonNode>> nodes = node.fields();
  10.  
  11. while (nodes.hasNext()) {
  12. Map.Entry<String, JsonNode> childNode = nodes.next();
  13.  
  14. if (childNode.getValue().isValueNode()) {
  15. if (childNode.getKey().startsWith("$")) {
  16. // DO Something
  17. }
  18. } else {
  19. analyseJSONNames(childNode.getValue());
  20. }
  21. }
  22. }
  23. }
Add Comment
Please, Sign In to add comment