Operator TupleToJSON

Primitive operator image not displayed. Problem loading file: ../../image/tk$com.ibm.streamsx.json/op$com.ibm.streamsx.json$TupleToJSON.svg

This operator converts incoming tuples to JSON String. Note that any matching attributes from the input stream will be copied over to the output. If an attribute, with the same name as the JSON string output attribute exists in the input stream, it will be overwritten by the JSON String that is generated.

Summary

Ports
This operator has 1 input port and 1 output port.
Windowing
This operator does not accept any windowing configurations.
Parameters
This operator supports 4 parameters.

Optional: inputAttribute, jsonStringAttribute, prefixToIgnore, rootAttribute

Metrics
This operator does not report any metrics.

Properties

Implementation
Java

Input Ports

Ports (0)
Properties

Output Ports

Assignments
Java operators do not support output assignments.
Ports (0)

Properties

Parameters

This operator supports 4 parameters.

Optional: inputAttribute, jsonStringAttribute, prefixToIgnore, rootAttribute

inputAttribute

Input stream attribute to be used as the root of the JSON object. Required type for attribute is tuple, list or set. Default is the input tuple. This parameter specfies the attribute, not its name, and is preferred to the rootAttribute parameter which specifies the attribute's name.

Properties
jsonStringAttribute

Name of the output stream attribute where the JSON string will be populated. Default is jsonString.

Properties
prefixToIgnore

Specifies a string that, if present, is removed from the start of an attribute name.You can use this method for JSON that contains elements or attributes with SPL or C++ keywords.For example:


stream <rstring jsonString> A = TupleToJSON(Input) {
  param ignorePrefix : "__";
}

This example accepts JSON of the following form:


{"graph" : "value"}

Since graph is an SPL keyword, stream<rstring graph> as input schema of TupleToJSON is not valid SPL.

Properties
rootAttribute

Deprecated. Name of the input stream attribute to be used as the root of the JSON object. Replaced by parameter inputAttribute which specifies the attribute rather than the attribute's name. Required type is tuple, list or set. Default is the input tuple.

Properties

Libraries

Operator class library
Library Path: ../../impl/lib/com.ibm.streamsx.json.jar, ../../lib/com.ibm.streamsx.json.converters.jar