While mapping of the JSON, the error occurs if we try to map the fild ìn`:
at com.api.jsonata4java.expressions.Expressions.parse(expressions.java:113)
at dynamic.mapping.processor.inbound.JSONProcessorInbound.extractFromSource(jsonprocessorinbound.java:108)
at dynamic.mapping.processor.inbound.AsynchronousDispatcherInbound$MappingInboundTask.lambda$call$1(asynchronousdispatcherinbound.java:203)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at dynamic.mapping.processor.inbound.AsynchronousDispatcherInbound$[MappingInboundTask.call](https://mappinginboundtask.call/)(asynchronousdispatcherinbound.java:137)
at dynamic.mapping.processor.inbound.AsynchronousDispatcherInbound$[MappingInboundTask.call](https://mappinginboundtask.call/)(asynchronousdispatcherinbound.java:100)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
2024-08-22 13:14:04.173 WARN 12 --- [ol-1-thread-202] d.m.p.inbound.JSONProcessorInbound : Tenant <tenant> - Substitution line_periodic_data[0].in not in message payload. Check your mapping counter/+
2024-08-22 13:14:04.197 INFO 12 --- [ol-1-thread-202] dynamic.mapping.core.C8YAgent : Tenant <tenant> - New measurement posted: {"self":"<url>","time":"2024-08-22T13:14:04.173Z","source":{"self":"<url>","id":"<id>"},"id":"<id>","type":"c8y_PeopleCounter","c8y_PeopleCounter":{"children_in":{"unit":"","value":0},"children_out":{"unit":"","value":0},"adults_out":{"unit":"","value":0},"group_in":{"unit":"","value":0},"group_out":{"unit":"","value":0}}}
Fix
On the MQTT Broker (EMQX) we fixed it renaming of the field from ìntopeople_in`. The rule engine of EMQX was utilized:
FOREACH
jq('.line_periodic_data[] |= (.people_in = .in | del(.in))', payload) as modified_payload
DO
modified_payload.device_info,
modified_payload.line_periodic_data,
modified_payload.line_total_data,
modified_payload.time_info
Initial situation
There is a people counter sensor, that sends data via MQTT on C8Y. The MQTT looks like:
pay attention to the field with the name
ìn
.The dynamic-mapper version is 4.4.0 (latest)
Error
While mapping of the JSON, the error occurs if we try to map the fild ìn`:
Fix
On the MQTT Broker (EMQX) we fixed it renaming of the field from ìn
to
people_in`. The rule engine of EMQX was utilized: