The JsonActor
(JSON transformation actor) is a Coral Actor that can transform an input JSON object into an output JSON object according to a supplied template.
The JsonActor has "type": "json"
. The params
value is a JSON object with the following field:
field | type | required | description |
---|---|---|---|
template |
JSON | yes | the template for the output |
The above example defines a template according to which the output JSON will be formatted. To access a field value in the trigger JSON, surround a field name with ${
… }
.
In the above example, the value of top-level field “referenceField” from the input JSON object is used as value for field “b” in the output JSON object. Sub-fields can be accessed by dot notation, as the field “ref.othersub” shows. Array elements can be accessed by [i]
where i
refers to the 0-based index of the element in the array.
The JsonActor
only does useful work if the trigger is connected.
The trigger can be any JSON object. The supplied JSON will be used to fill the template.
The JsonActor
emits the transformed JSON object.
The JsonActor
does not keep any state.
The JsonActor
does not collect state from other actors.
The JsonActor
does not provide timer actions.