Input stream can be converted into the JSON string.
About what kind of the JSON format can be converted to, please refer to "How to Convert".
| Input | Format | CSV,FixedLength,XML,ParameterList,Record |
|---|---|---|
| Number of Inputs | 1 | |
| Description | CSV, FixedLength, XML, ParameterList, Record stream can be input. Stream container can't be received. | |
| Output | Format | Text |
| Description | Convert the input stream to the JSON string and output it. |
| Name | Data Type | Mapping | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Indent | boolean | Out |
Specify whether to indent or not.
|
||||||
| JSONRecordObjectName | choice | In & Out |
When the input stream is CSV, Record or FixedLength, specify the top level name of the JSON object. Value can be input directly. If "(none)" is specified, the input stream will be output as an array. About the description, please refer to "How to Convert" as below.
|
||||||
| IgnoreNamespacePrefix | boolean | Out |
When the input stream is XML, specify whether to delete the namespace prefix or not.
|
||||||
| OmitRootElement | boolean | Out |
When the input stream is XML, specify whether to delete the root element or not.
|
This component doesn't loop.
| Commit | Do nothing |
|---|---|
| Rollback | Do nothing |
| Type | Parameter | Stream for error handling flow | Error Code | Description |
|---|---|---|---|---|
| Exception | None | This component's input stream | 1 | The input stream type isn't CSV, FixedLength, XML, ParameterList or Record. |
| 2 | Can't be converted to the JSON string. |
Input stream can be converted as below with each format.
When the JSONRecordObjectName property is set to "record", an array will be created with the "record" key on the top level. An array element is an object which takes each record's field name as a key. If the value except "record" is assigned, the assigned value can be a top level key.
{ "record":[
{ "field1": "aaa", "field2": 1, "field3": true},
{ "field1": "bbb", "field2": 2, "field3": false},
{ "field1": "ccc", "field2": 3, "field3": true}]
}
When the JSONRecordObjectName property is specified to "(none)", an array which doesn't have a key in the top level will be created. An array element is an object which takes each record's field name as a key.
[
{ "field1": "aaa", "field2": 1, "field3": true},
{ "field1": "bbb", "field2": 2, "field3": false},
{ "field1": "ccc", "field2": 3, "field3": true}
]
Take a field name as a key, and each field value is output to the top level.
{
"field1": "aaa",
"field2": ["aaa", "bbb", "ccc"],
"field3": 10
}
Convert the input stream into json object according to the following rules and XML structure.
1) Example of XML before conversion
<root>
<record attr1="1">
<element1>aaa</element1>
</record>
<record attr1="2">
<element1>bbb</element1>
</record>
</root>
JSON string after conversion
{ "root": {
"record": [
{
"attr1": "1",
"element1": "aaa"
},
{
"attr1": "2",
"element1": "bbb"
}
]}
}
2) Example of XML before conversion (When there is a namespace, IgnoreNamespacePrefix is specified to "true", and the property is same as the element nameļ¼
<root xmlns:fs="http://www.example.com/">
<fs:record fs:id="1">
<fs:name>aaa</fs:name>
<fs:id>1-1</fs:id>
<fs:id>1-2</fs:id>
</fs:record>
<fs:record id="2">
<fs:name>aaa</fs:name>
<fs:id>2-1</fs:id>
<fs:id>2-2</fs:id>
</fs:record>
</root>
JSON string after conversion
{ "root": {
"record": [
{
"id": "1",
"name": "aaa",
"id": ["1-1", "1-2"]
},
{
"id": "2",
"name": "aaa",
"id": ["2-1", "2-2"]
}
]}
}
These streams can't be converted to JSON.