Skip to content

Patch for when JsonNode child is null #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/javasource/jsontotree/Misc.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ private static void traverse(IMendixObject rootObject, IContext ctx, JsonNode no
*/
private static void traverseObject(IMendixObject rootObject, IContext ctx, JsonNode node, String childKey, IMendixObject parentMXObject) {
JsonNode child = node.get(childKey);
boolean hasChild = traversable(child);
boolean hasChild;
if (child == null){
hasChild = false;
} else {
hasChild = traversable(child);
}

JSONObject copy = createJSONObject(node, childKey);
String jsonContent = copy.toString();

Expand Down Expand Up @@ -164,4 +170,4 @@ private static IMendixObject createNodeObject(IContext ctx, IMendixObject rootOb
return JSONRepresentationObject;
}

}
}