JSON to different table API reference
API reference for the JSON to different table transform method
Request examples
Minimal
{
"api": "hub",
"apiVersion": "1.0",
"action": "createIntegrationTable",
"params": {
"tableName": "test1",
"fields": [
{
"name": "In1",
"type": "varchar"
}
],
"transformSteps": [
{
"transformStepMethod": "jsonToDifferentTableFields",
"targetTableName": "test_out2",
"mapOfPropertiesToFields": [
{
"recordPath": "in1.out1",
"fieldName": "out1"
}
]
}
]
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}The following example is not the maximal example for creating an integration table; rather, it is the maximal example for creating a JSON to different table transform.
{
"api": "hub",
"apiVersion": "1.0",
"action": "createIntegrationTable",
"params": {
"tableName": "test1",
"transformSteps": [
{
"transformStepMethod": "jsonToDifferentTableFields",
"targetTableName": "my_table",
"mapOfPropertiesToFields": [
{
"recordPath": "source_payload.temperature",
"fieldName": "temperature_a"
},
{
"recordPath": "source_payload.temperature",
"fieldName": "temperature_b"
},
{
"recordPath": "source_payload.temperature",
"fieldName": "temperature_c"
}
]
}
]
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Note
The jsonToDifferentTableFields transform will automatically add the following fields to the target table if they do not already exist. When the transform inserts a new row into the target table, it auto-populates these fields:
change_idcreate_tsidout1out2source_databasesource_idsource_schemasource_table
If any existing field or index has the same name as one of these but with a mismatched schema definition, the transform will fail and prompt the user to fix this conflict.
{
"result": {},
"requestId": "00000007",
"errorCode": 0,
"errorMessage": "",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
API reference for the JSON to different table transform method
The "params" property is an object that contains an action's request parameters as defined by a set of properties. Each action defines its own required and optional properties. See System limits for a comprehensive overview of property requirements and limitations.
"params" property summariesProperty | Description | Default | Type | Limits | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(optional) specifies the name of a table. |
| string | 1 to 64 bytes | ||||||||||
(optional) contains objects that specify the settings of a field in a table. |
| string | 0 or more objects | ||||||||||
| (optional) specifies the name of a field. |
| string | 0 to 64 bytes | |||||||||
| (optional) specifies the data type of a field. |
| string | see link | |||||||||
specifies an array of transform objects. | Required - No default value | array of objects | 0 or more objects | ||||||||||
| (optional) specifies the field in the table to be mapped to a field containing JSON properties. |
| array |
| |||||||||
| specifies the name of a field in a table. | Required - No default value | string | 1 to 64 bytes | |||||||||
| specifies the location in a record where the server reads or writes a JSON value. | Required - No default value | string | 0 to 256 bytes | |||||||||
| (optional) specifies the name of the target table. |
| string | 1 to 64 bytes | |||||||||
| specifies the transform method the step will use. | Required - No default value | string enum |
|
The "tableName" property contains the name of the table in the database where the event occurred. It is a non-zero-length string.
See table name in System limits for table naming requirements and limitations.
A table in DBnotify is defined by "databaseName", "ownerName" and "tableName" or by "dataFilePath".
The "fields" property is an array of objects. It is required when creating a table. Each object in the array defines a field by specifying its properties.
Example
"fields": [
{
"autoValue": "none",
"name": "name",
"type": "varchar",
"length": 50,
"scale": null,
"defaultValue": null,
"nullable": false
}
]The "name" property is a required string. It is the field named that is mapped to the property name specified in "propertyPath".
It must be <= 64 ASCII characters.
It must be unique in the table.
It should be lowercase with underscores separating the parts of the name; otherwise, SQL requires you to enclose the name in double quotes.
A field name is case-sensitive in JSON NAV and in SQL.
In SQL, a quoted field name is case sensitive and an unquoted field name can be any case but it only matches a lowercase field name. Because of this complexity in SQL, use lowercase field names.
When c-tree receives a data message, it extracts the value from the JSON property specified by
"propertyPath"and stores it in the table field specified by this"name"property.
The "type" property is a required string that defines the data type of the field in the table. See Data Types in the FairCom DB SQL Reference Guide for full documentation on FairCom field types.
If a field is configured incorrectly, the operation fails. FairCom logs an error to its CTSTATUS.FCS file.
You can first create a table in SQL and then create a Persistence Topic that is assigned to that table.
Some SQL types are not specified in the list of MQTT types.
Table 2. How Additional SQL Types Map to MQTT TypesSQL
MQTT
LVARCHAR
LVARBINARY
NUMERIC
NUMBER
DECIMAL
NUMBER
MONEY
NUMBER
FLOAT
DOUBLE
Valid field types include:
"DATE"stored as days since March 1, 1700
"TIME"stored as milliseconds since midnight
"TIMESTAMP"stored as a date and a time
"TINYINT"8-bit Integer
"SMALLINT"16-bit Integer
"INTEGER"32-bit Integer
"BIGINT"64-bit Integer (-9223372036854775807 to 9223372036854775806, which is 1 "inward" from the industry standard of -9223372036854775808 to 9223372036854775807)
"MONEY"10 decimal digits with 2 decimal places
"NUMBER"32 decimal digits with N decimal places specified by the
"scale"property"REAL"32-bit IEEE binary floating point number
"DOUBLE"64-bit IEEE binary floating point number
"CHAR"Fixed-length ASCII string <= 8,192
"NCHAR"Fixed-length UTF-16 string <= 65,535
"VARCHAR"Variable-length ASCII string <= 8,192
"LVARCHAR"Variable-length ASCII string <= 2GB
"NVARCHAR"Variable-length UTF-16 string <= 65,535
"BIT"Boolean that interprets the listed values as 0 and all others are interpreted as 1
The values are interpreted as 0:0
0.0
-0
false (using any case)
an empty string
null
{ }
[ ]
"BINARY"Fixed-length array of bytes <= 8,192
"VARBINARY"Variable-length array of bytes <= 65,535
"LVARBINARY"Variable-length array of bytes <= 2GB
"JSON"Variable-length UTF-16 string <= 65,535
Note
"CURRENCY"is currently an unsupported field type."CURRENCY"is a 19 decimal digits with 4 decimal places.
The "transformSteps" property is an array of transform step objects.
Different actions interpret "transformSteps": [] differently.
In the
"alterIntegrationTable"action,"transformSteps"is optional. Setting it to[]removes transform steps from the integration table.In the
"createIntegrationTable"action,"transformSteps"is optional. Setting it to[]is the same as setting it tonullor omitting it.In the
"testIntegrationTableTransformSteps"actions,"transformSteps"is required; thus, omitting it or setting it to[]ornullis an error.
Each transform step object contains the required "transformStepMethod" property. It also supports the following optional properties:
"transformStepName""transformStepService"
Each transform step method also supports unique properties that are defined below.
"transformStepMethod": "javascript"
Required properties
"codeName"
Optional properties
"ownerName""databaseName"
"transformStepMethod": "tableFieldsToJson"
Required properties
"mapOfPropertiesToFields"
"transformStepMethod": "jsonToTableFields"
Required properties
"mapOfPropertiesToFields"
"transformStepMethod": "jsonToDifferentTableFields"
Required properties
"mapOfPropertiesToFields""targetTableName"
Optional properties
"targetOwnerName""targetDatabaseName"
The "mapOfPropertiesToFields" property takes fields in the table and maps them to a field containing JSON properties. It is an array of property map objects. Each object maps a field in a table to a JSON property in another field.
Required properties
"recordPath""fieldName"
Optional properties
"binaryFormat""numberFormat""variantFormat""dateFormat""timeFormat"
The required "fieldName" property specifies a field in a record. Depending on the context, the server reads or writes the field's value.
For example, in the "tableFieldsToJson" transform method, "fieldName" is the location where the transform step reads a value that it transforms. In the "jsonToTableFields" and "jsonToDifferentTableFields" transform methods, "fieldName" is the location where the transform step writes a transformed value.
The "recordPath" property specifies the location in a record where the server reads or writes a JSON value. It specifies a field name followed by an optional JSONPath. Depending on the context, it refers to a value the server reads or writes.
For example, in the "tableFieldsToJson" transform method, "recordPath" is the location where the transform step writes a transformed value. In the "jsonToTableFields" and "jsonToDifferentTableFields" transform methods, "recordPath" is the location where the transform step reads the value that it transforms.
The
"recordPath"property must always include a field name.The server returns an error when the field name is missing or does not exist.
The
"recordPath"property may include a JSONPath after the field name.If no JSONPath follows the field, the
"recordPath"property refers to the entire field, and the field is not required to contain a JSON document.If a JSONPath follows the field, the
"recordPath"property refers to a part of the JSON document inside the field.
Several FairCom APIs, such as the DB and Transform APIs, treat each record in each table as a JSON document. The top-level fields in the record are treated as top-level properties in the JSON document. In other words, you can think of each record as a JSON document, and you can use the "recordPath" property to refer to any field in the record and any JSON property or array item within a JSON field.
When the server writes a value to a "recordPath", it looks for the specified field and JSONPath and does the following.
If the specified field does not exist, the server returns an error.
If the JSONPath is not specified after the fieldname, the server writes the value directly to the field.
If the field's value does not contain a JSON document, the server returns an error.
If the JSONPath specifies a property or array item that does not exist in the field's JSON document, the server adds it.
If the JSONPath specifies a property or array item that already exists in the field's JSON document, the server replaces the value.
When the server reads a value from a "recordPath", it looks for the specified field and JSONPath and does the following.
If the specified field does not exist, the server returns an error.
If the JSONPath is not specified after the fieldname, the server reads the entire field value.
If the field's value does not contain a JSON document, the server returns an error.
If the JSONPath specifies a property or array item that does not exist in the field's JSON document, the server returns
nullbecause FairCom's data model treats a missing JSON property the same as one assigned tonull.If the JSONPath specifies a property or array item that already exists in the field's JSON document, the server replaces the value.
Note
Unlike "propertyPath", a "recordPath" includes the name of the field that contains the JSON document.
Simple "recordPath" example
For example, a recordPath of "temperature" refers to a field named "temperature".
Example record in an integration table
The following record contains three fields: id, source_payload, and create_ts.
id | source_payload | create_ts |
|---|---|---|
| {
"humidity":
[
{
"temperature": 20.1,
"pressure": 1003
}
]
}
|
|
JSON representation of the example record
The following JSON shows how the JSON DB and Transform APIs represent the previous record. The top-level properties are fields in the integration table.
{
"id": 1,
"source_payload":
{
"humidity":
[
{
"temperature": 20.1,
"pressure": 1003
}
]
},
"create_ts": "2025-07-07T14:14:02.012"
}
"recordPath" properties for each value in the example record
"recordPath" | Field Value |
|---|---|
|
|
| {
"humidity":
[
{
"temperature": 20.1,
"pressure": 1003
}
]
}
|
| [
{
"temperature": 20.1,
"pressure": 1003
}
]
|
| {
"temperature": 20.1,
"pressure": 1003
}
|
|
|
|
|
|
|
The required "recordPath" property specifies the location of a JSON property in a record. It starts with the name of a field in the table followed by an optional JsonPath to a JSON property within that field.
The required "targetTableName" property specifies the name of the target table that has its transform steps replaced by this action.
Note
The fully qualified name of a table includes the database, owner, and table names.
The "transformStepMethod" property is a required string that specifies the type of transform, such as the "javascript" transform method that runs JavaScript to change the table's data or the "jsonToTableFields" transform method that extracts values from properties in a JSON field and stores them in other fields.
Note
The "transformStepMethod" property replaces the deprecated "transformActionName" property.
The value of the "transformStepMethod" affects the value of the "transformService" property. The following table defines the possible values of the "transformService" property when combined with the "transformStepMethod". Notice that some transform step methods are built into the server and do not require you to specify the "transformService".
|
|
|---|---|
|
|
|
|
|
|
|
|
|
|
Note
If the "transformStepMethod" property is set to "javascript", the "transformService" property must be set to "v8TransformService".