"propertyPath"
Specifies the location in a JSON document where the server reads or writes a value
The "propertyPath"
property is a JSONPath that specifies the location in a JSON document where the server reads or writes a value. The FairCom server creates properties as needed.
The FairCom Edge device connectors collect data tags from IoT devices and put them in the JSON document that exists inside the source_payload
field. The connectors use the "propertyPath"
property to specify the location where the connector puts the data in the JSON document.
Note
Unlike "recordPath"
, a "propertyPath"
does not include the name of the field that contains the JSON document.
Simple "propertyPath"
example
For example, a JSONPath of "temperature"
refers to a top-level property named "temperature"
. You can use "propertyPath": "temperature"
to configure a FairCom data connector to take a value it collects, such as 70
, and store it in a "temperature"
property, such as { "temperature": 70 }
.
{ "temperature": 70" }
When the server writes a value to a JSONPath, it looks for the specified location in the JSON document. If the specified property or array item does not exist, the server creates it and assigns a value to it. If the property already exists, the server replaces its current value.
When the server reads from a JSONPath, it looks for the specified location in the JSON document. If the specified property or array item does not exist, it returns null
. If it exists, it returns the value assigned to the property.
Complex "propertyPath"
examples
You can use complex JSONPath values to nest properties and refer to items in arrays, such as the properties and array items in the following example.
{ "humidity": [ { "temperature": 20.1, "pressure": 1003 } ] }
"recordPath"
properties for each value in the example record
| Field Value |
---|---|
| [ { "temperature": 20.1, "pressure": 1003 } ] |
| { "temperature": 20.1, "pressure": 1003 } |
|
|
|
|