Overview:
- This document provides instructions to convert JSON data to CSV by using the SDC pipeline.
Configuration:
JSON to CSV converter pipeline looks as below way:
![](https://uploads-us-west-2.insided.com/streamsets-en/attachment/ce242a8e-4113-4dc5-ad46-5d0c16b6482f.png)
Directory Origin:
- This stage reads the employee JSON file from the input directory and provides the output as an array of JSON.
- The output of this stage looks as below way:
![](https://uploads-us-west-2.insided.com/streamsets-en/attachment/cb13b473-2dc5-4fc7-a8cd-a2c7768926a2.png)
Field Pivoter:
- This stage converts the array of JSON to individual records.
- Here is the output of the stage:
![](https://uploads-us-west-2.insided.com/streamsets-en/attachment/88fa5ca9-cf6a-45a8-8755-5efe4e955221.png)
Field Order:
- This stage converts the record root field 'MAP' to List-Map. So, that it is compatible with CSV records.
![](https://uploads-us-west-2.insided.com/streamsets-en/attachment/ba01d2b9-c99d-4d20-acf8-ea6655229e7b.png)
- If this stage is not used then you will see the below error message in destination:
DELIMITED_GENERATOR_00 - Record 'employee.json::0_1' root field should be List or List-Map instead of 'MAP'
![](https://uploads-us-west-2.insided.com/streamsets-en/attachment/49366c62-193a-4865-9a16-d6fa094661e4.png)
LocalFs Destination:
- This stage places the data as CSV in the destination location.
Input JSON file:
![](https://uploads-us-west-2.insided.com/streamsets-en/attachment/1bb02d9c-7a65-4dcc-aafd-0b702d0706ba.png)
Output CSV file:
![](https://uploads-us-west-2.insided.com/streamsets-en/attachment/258e5bd9-dfdf-4f95-af8a-aba1ce37b521.png)