Skill level: Intermediate
Time required: 6 minutes
This article explains how to easily convert JSON data into a raw CSV file using the JSON to CSV app by Quickwork.
Prerequisites
- A Quickwork account and and familiarity with the platform's GUI.
Why is CSV data important
CSV (Comma-Separated Values) files are plain text, making them easy to create and import into spreadsheets or databases. They are ideal for organizing and managing large datasets effectively.
Supported data types for JSON to CSV conversion:
- An object of JSON data
- An array of objects containing JSON data
Rules for specifying the raw JSON data:
- Enclose data in curly braces {}.
- Do not include a trailing comma , after the last JSON object in an array.
- Enclose string key-value pairs in double quotes "".
Violation of any of the above rules will throw an error as Bad request.
Step-by-step guide
Configuring the trigger
- In the Event section, choose the Scheduler by Quickwork app from the drop-down menu in the Apps field.
- Select the trigger event, New scheduled event, from the drop-down menu in the Triggers field.
- Set the Interval for One day as we need to fetch the breaking news on a daily basis.
- Set the date and time of your choice in the Start at field and keep the Custom payload field empty.
Configuring the JSON to CSV action
- Under the Steps section, click on the Simple Action button and choose the JSON to CSV app from the drop-down menu in the Apps field.
- Select the Convert JSON to CSV action from the drop-down menu in the Actions field.
- No authorization is required as this is a self-created app of Quickwork.
- In the JSON data source field, select:
- String: If you’re hardcoding the JSON data.
- URL: If the JSON data is accessible via a URL.
-
In the Output field type, select:
- CSV output as URL: To generate a downloadable CSV file.
- String: To get the output as plain text.
-
In the JSON data field, specify the JSON you want to convert. For example,
[
{
"userId": 123,
"age": 25,
"name": "Mr. Andrew Hall",
"designation": "Software Engineer"
},
{
"userId": 456,
"age": 27,
"name": "Mr. Simpson Cliff",
"designation": "Technical Writer"
},
{
"userId": 789,
"age": 40,
"name": "Ms. Phelope Shaw",
"designation": "Graphics Designer"
},
{
"userId": 290,
"age": 35,
"name": "Mr.Scott Styris",
"designation": "Marketing Manager"
}
]
Note: You can generate the sample JSON data from JSONPlacholder while testing this app. Ensure to remove the comma from the last curly bracket of the JSON object, else you'll face an error.
- In the Fields field, specify all the keys present in your JSON object in a comma-separated format. For example, userId,age,name,designation.
Executing the journey
- Save the journey and click Save & Start.
- Go to the History tab to view the execution details.
- In the Steps section, expand the JSON to CSV action to find the generated CSV file URL in the Output block.
Accessing the CSV data
- Copy the URL provided in the Output block.
- Paste it into your browser to view the CSV data.
Use this CSV file for storing data in legacy systems or databases.
By following these steps, your JSON data will be successfully converted to CSV format for further use.
Comments
0 comments
Please sign in to leave a comment.