I have been trying to create a proper object node which would result in the following json structure:
{"key": [
{
"param_name": "device",
"active": true
}
]}
I have tried various options with the last one being create a list of linkedhashmap’s (since it seems like it’s what is used behind the scenes for object nodes)
List<LinkedHashMap<String, Object>> listOfScopes = new ArrayList<>();
LinkedHashMap<String, Object> scope = new LinkedHashMap<>();
scope.put("param_name", "device");
scope.put("active", true);
listOfScopes.add(scope);
ObjectNode ticketParams = om.createObjectNode();
ticketParams.set("key", listOfScopes); // this gives an error about incompatible types
Can anyone suggest what is missing here? I am quite fresh with Java and I am probably missing something obviou here.