com.ibm.streamsx.topology.json (Java Application API for IBM Streams)
Date: 2020-08-07

# Package com.ibm.streamsx.topology.json

JSON streams.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  JSONSchemas | SPL schema for JSON.

- Class Summary
  Class | Description
  --- | ---
  JSONStreams | Utilities for JSON streams.
  JSONStreams.DeserializeJSON | Function to deserialize a String to a JSONObject.
  JSONStreams.SerializeJSON | Function to serialize a JSONObject to a String.
  JSONStreams.ToJSON<T extends JSONAble> | Function to convert a `JSONAble` tuple to a `JSONObject`, using `JSONAble.toJSON()`.

## Package com.ibm.streamsx.topology.json Description

JSON streams. JSON (JavaScript Object Notation) is a lightweight data-interchange format that can be used to exchange streams between applications implemented in different languages.

### Java

Within Java the recommended stream type for JSON data is `TStream<JSONObject>`.
When a tuple is a JSON array the approach is to use an `JSONObject` with a single attribute `payload` containing the value (for example, an array of JSON objects}.

### SPL

Within SPL the recommended stream type for JSON data is `tuple<rstring jsonString>`, representing serialized JSON. (see `JSON`). This is the convention used by the SPL toolkits `com.ibm.streamsx.json` and `com.ibm.streamsx.inet`.

### Conversions

| To
--- | ---
From | Java (TStream<JSONObject>) | SPL (`rstring jsonString`)
Java | TStream<JSONObject> |  | `JSONStreams.toSPL()`
TStream<? extends JSONAble> | `JSONStreams.toJSON()` |
TStream<String> | `JSONStreams.deserialize()` |
SPL | SPLStream (`rstring jsonString`) | `SPLStream.toJSON()` |
SPLStream (any other schema) |

See Also:
  http://www.json.org - JSON (JavaScript Object Notation) is a lightweight data-interchange format.