Skip to content

Instantly share code, notes, and snippets.

@chamithchathuka
Created August 7, 2021 06:24
Show Gist options
  • Select an option

  • Save chamithchathuka/9cda56b7110b29bb3df6fa279edd2aa4 to your computer and use it in GitHub Desktop.

Select an option

Save chamithchathuka/9cda56b7110b29bb3df6fa279edd2aa4 to your computer and use it in GitHub Desktop.
public void deepDive(JsonObject members) {
for (Map.Entry<String, JsonElement> entry : members.entrySet()) {
System.out.println("deepDive");
if (entry.getValue().isJsonArray()) {
JsonArray asJsonArray = entry.getValue().getAsJsonArray();
asJsonArray.forEach(jsonElement -> {
deepDive(jsonElement.getAsJsonObject());
});
} else if (entry.getValue().isJsonObject()) {
deepDive(entry.getValue().getAsJsonObject());
} else {
System.out.println(entry.getKey() + "=" + entry.getValue());
if (!entry.getValue().isJsonNull()) {
if (entry.getValue().getAsString().startsWith("${")) {
System.out.println("variable");
System.out.println(entry.getKey() + "=" + entry.getValue());
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment