I think your issue is your not creating the variable correctly. The engine is expecting a String and your creating a JSON object. The documentation states (quite briefly) S() api takes a string as input.
I’m starting this process with a String formatted as JSON using the Java API.
JSONObject json = new JSONObject()
.put(
"meta", new JSONObject().put("category", 2)
);
Map<String, Object> varibles = Variables.putValue("product", json.toString());
// Either: Drive the process by API and assert correct behavior by camunda-bpm-assert, e.g.:
ProcessInstance processInstance =
processEngine().getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY, varibles);
In my expression task I can use the .prop notation with no problem.
${S(product).prop('meta').prop('category').numberValue() == 2}
Now using JSON to start my process
{
"variables":
{
"product":
{
"value":"{\"meta\":{\"category\":2}}","type":"String"
}
}
}