Skip to main content

"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
    }
  ]
}
Table 1. "recordPath" properties for each value in the example record

"recordPath"

Field Value

"propertyPath": "humidity"

[
  {
    "temperature": 20.1,
    "pressure": 1003
  }
]

"propertyPath": "humidity[0]"

{
  "temperature": 20.1,
  "pressure": 1003
}

"propertyPath": "humidity[0].temperature"

20.1

"propertyPath": "humidity[0].pressure"

1003



The "propertyPath" in FairCom's JSON API is a JSONPath expression that defines where to read or write a value within a JSON document, with the server automatically creating properties if they don't exist during a write operation. Unlike "recordPath", it does not include the field name containing the JSON document. This property is crucial for FairCom Edge device connectors, enabling them to specify the exact location within a source_payload field where collected IoT data tags should be placed. When reading, if a specified path doesn't exist, it returns null; otherwise, it retrieves the existing value.

propertyPath JSON
JSONPath propertyPath
JSON document location
read write JSON value path
property path in JSON
how to specify JSON data location
define JSON write path
configure JSON read path
configure propertyPath
define propertyPath
specify propertyPath
customize propertyPath
customize write path
edit write path
edit propertyPath