Data to JSON
(Text Processing)
Synopsis
Transforms and unflattens an example set into JSON documents.Description
This operator transforms example sets wither into a collection of JSON documents such that each example is converted into a separate document, or into a single JSON array containing all examples.
Attribute names representing nested structures are unflattened. The operator thereby assumes that dots indicate nested objects and that square brackets are used to denote arrays. For instance, an example set with attributes "point.x" and "point.y" will be transformed into a collection of JSON documents of the form {"point": {"x": ..., "y": ...}}. Similarly, an example set with attributes "x", "y[0]" and "y[1]" will be transformed into a collection of documents of the form {"x": ..., "y": [..., ...]}.
Note that not every example set can be transformed into a collection of JSON documents (or into a JSON array), since attribute names may contradict each other. For instance, the attribute names "x.y" and "x[0]" contradict each other, since the first attribute name implies that "x" is a JSON object, whereas the latter implies that "x" is an JSON array.
Input
example set (Data table)
The example set or sets containing the examples which should be transformed to JSON documents.
Output
documents (Collection)
Either a collection of JSON documents extracted from the example set, or a single JSON array containing all examples.
Parameters
- ignore arrays If the checkbox is activated, the operator ignores nested array structures. If the checkbox is deactivated, the operator includes nested array structures.
- generate array If the checkbox is activated, the operator outputs a single JSON array containing all examples. If the checkbox is deactivated, the operator outputs a collection of JSON documents.
- include missing values If the checkbox is activated, missing values from the example set are added to the JSON document as null. If the checkbox is deactivated, missing values are ignored and are not included in the JSON document.