objects must have exactly 1 key defined
I encountered this exception when trying to let JsonLogic return a two-keyed object:
{ "resultType": "statistics", "resultValue": 2 }
Is there any method to return Json object as result? Thanks.
I'm seeing the same issue and it makes the Java implementation incompatible with the javascript one.
For instance, the following rule will compute fine in JS but will fail in Java.
{ "if": [ { "==": [ 2, 2 ] }, { "key_1": 0, "key_2": 0 }, { "key_1": null, "key_2": null } ] }
As a workaround, can you treat your data as a string instead?
For example,
{
"if": [
{"==": [2, 2]},
"{\"key\": \"value1\"}",
"{\"key\": \"value2\"}"
]
}
I saw a similar result trying to evaluate this rule:
{"and":[{"<":[5,10]},{">":[20,10]},{"==":["ON","ON"]},{">":[43200,36000]},{"<":[43200,68400]}],"or":[{">":[40,10]},{"==":["ON","ON"]}]}
It seems to work fine on the rule evaluator though