Operator TupleToJSON
Converts incoming tuples to JSON Strings.
Note: 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
- Ports (0)
- Properties
-
- Optional: false
- ControlPort: false
- WindowingMode: NonWindowed
- WindowPunctuationInputMode: Oblivious
- Assignments
- Java operators do not support output assignments.
- Ports (0)
-
- Properties
-
- Optional: false
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
-
- Cardinality: 1
- Optional: true
- ExpressionMode: Attribute
- jsonStringAttribute
-
Name of the output stream attribute where the JSON string will be populated. Default is jsonString.
- Properties
-
- Type: rstring
- Cardinality: 1
- Optional: true
- 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
-
- Type: rstring
- Cardinality: 1
- Optional: true
- 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
-
- Type: rstring
- Cardinality: 1
- Optional: true
- Operator class library