FTL JSON Message Format Reference

This section details the specific formatting of JSON messages used by the ActiveSpaces Connector for Apache Kafka. This subset of JSON is referred to here as FTL JSON.

The TIBCO FTL JSON message format is a subset of JSON, with some field type annotations to allow for more accurate field type conversions. It is also referred to as eFTL-flavored JSON and is used by other TIBCO products and connectors, including the Bridge to Apache Kafka Bridge, Bridge to Apache Pulsar, and, eFTL.

FTL JSON supports five basic field types: long, string, double, tibdatetime, and opaque, as well as arrays of those types. The long and string types are represented as standard JSON numbers and strings without any special annotations. Thus, the following JSON message is also a valid FTL JSON message, containing a long field named "my-long-field" and a string field named "my-string-field", as follows:

{
    "my-long-field": 123,
    "my-string-field": "hello!"
}

The other types are represented by JSON objects containing a single field with a special reserved field name indicating the type. For example, a double is indicated by a JSON object containing a single field with the reserved name "_d_":

{
    "my-double-field": { "_d_": 7.8 }
}

Adding "my-double-field" to the previous JSON message:

{
    "my-long-field": 123,
    "my-string-field": "hello!"
    "my-double-field": { "_d_": 7.8 }
}

Encoding Rules

For encoding rules for all supported types, as well as their Java-language equivalents, see the following table:

Java Declaration A2AS-JSON Equivalent
long myLong = 1;
"myLong": 1
long[] longArray = {1, 2, 3};
"longArray": [ 1, 2, 3 ]
String myString = "hello!";
"myString": "hello!"
String[] stringArray = {"eeny", "meeny", "miny"};
"stringArray": [ "eeny", "meeny", "miny" ]
double myDouble = 1.23;
double myNaN = Double.NaN;
double myPosInf = Double.POSITIVE_INFINITY;
double myNegInf = Double.NEGATIVE_INFINITY;
{ "_d_": 1.23 }
{ "_d_": "NaN" }
{ "_d_": "Infinity" }
{ "_d_": "-Infinity" }
double[] doubleArray =
  {1.1,
   Double.POSITIVE_INFINITY,
   Double.NEGATIVE_INFINITY,
   Double.NaN};
message.setArray("my-double-array", doubleArray);
"my-double-array": [
  { "_d_": 1.1 },
  { "_d_": "Infinity" }, 
  { "_d_": "-Infinity" },
  { "_d_": "NaN" }
]
TibDateTime dateTime = new TibDateTime();
dateTime.set(443815200, 0);
"dateTime": { "_m_": 443815200000 }
Note: TibDateTime is an FTL-specific field type. It is represented as a JSON object with a single field named "_m_". Its value must be a JSON number, that represents the number of milliseconds since the UNIX Epoch.

The FTL JSON representation excludes nanoseconds, truncating to the nearest millisecond.

TibDateTime dt1 = new TibDateTime();
dt1.set(1168365600, 0);
TibDateTime dt2 = new TibDateTime();
dt2.set(1003860000, 0);
TibDateTime dt3 = new TibDateTime();
dt3.set(1003860000, 0);
TibDateTime[] dateTimeArray = {dt1, dt2, dt3};
"dateTimeArray": [
  { "_m_": 1168365600000 },
  { "_m_": 1003860000000 },
  { "_m_": 1003860000000 }
]
byte[] myBinaryData = {'H', 'i'};;
"my-opaque": { "_o_": "SGk=" }
Note: Arbitrary binary data is represented as a JSON object with one field named "_o_". Its value is a JSON string containing base64-encoded binary data.