Prerequisites: The following instructions assume that you have an incoming message (payload) with the following key value
pairs: “hue”, “sat”, “bri”, “on”.
{
"hue": 43211,
"sat": 254,
"bri": 254,
"on": true
}
Perform the following steps:
- Open the palette, expand and drag a JsonDemuxRouter component to a desired location in the station.
- Open the JsonDemuxRouter’s Property Sheet by double-clicking the router.
The property sheet view displays.
NOTE: Enabling Learn Mode adds a dynamic slot on input. This procedure documents how to add the slot manually.
- Manually add a baja:double slot by opening the AX Slot Sheet view, or by simply right-clicking the sheet and clicking Add Slot.
An
Add Slot window opens for either method, as shown below.
| Adding a slot from the Slot Sheet View |
Adding a slot using the Action menu |
 |
 |
- To add the slot to the JsonDemuxRouter component, give the slot a name (“hue” for this example), choose
Type: baja:Double and click OK.The new slot is added.
- In the Wire Sheet view, connect the schema output to the JsonDemuxRouter component’s Route slot.
The following image shows a
Wire Sheet view of components routing part of an incoming message to the slot for onward processing. The slot that you add must match
the key name, to select that key, and should be either Boolean, Numeric or String to match the JSON value.
Once the JsonDemuxRouter component has a slot of type baja:Double named "hue", it passes the hue to expose the value “43211” for use in the station.
NOTE: To extract nested JSON objects, add a string with an appropriate name, for example, a demuxed string named ‘data’ could contain
this entire nested object:
{
"type" : "line",
"data" :
{
"labels" : ["Sunday", "Monday"],
"values" : [ 1, 2 ]
}
}