CORAL WIKI

JsonActor

The JsonActor (JSON transformation actor) is a Coral Actor that can transform an input JSON according to a supplied template.

Creating a JsonActor

The creation JSON of the JsonActor (see Coral Actor) has "type": "json". The params value is a JSON with the following field:

field type required description
template JSON yes the template for the output

Example

{
  "data": {
    "type": "actors",
    "attributes": {
      "type": "json",
      "params": {
        "template": {
          "a": "some constant text",
          "b": "${referenceField}",
          "c": "${ref.sub.sub[2]}",
          "d": {
            "e": "${ref2}",
            "f": "${ref3}"
          }
        }
      }
    }
  }
}

If fields are expressions the create a string field starting with a the expression (according to the coral JSON expression parser) surrounded by ${}.

Trigger

The JsonActor only does useful work if the trigger is connected. The trigger can be any JSON. The supplied JSON will be used to fill the template.

Example

Emit

The JsonActor emits the transformed JSON. That is the template JSON with expressions replaced with their evaluation from the trigger input.

State

The JsonActor keeps no state.

Collect

The JsonActor does not collect state from other actors.

Timer

The JsonActor does not provide timer actions.