Need to input json format file and convert into csv file

SUSHIL
Level 3
Need to input json format file and convert into csv file

Hi, 

I have file in the format of json. 

Need to upload json file and need to convert and prepare data in csv format. 

How I need to do that, can you guide me. 

0 Kudos
8 Replies
Manuel
Dataiker Alumni

Hi Sushil,

After uploading the file with the json format, using a Prepare recipe and the Unnest processor to flatten the data into columns.

I hope this helps.

0 Kudos
SUSHIL
Level 3
Author

Hi, still not able to solve the problem. 

Can you please guide me the some python code which can read json file as input and convert into csv file format as output. 

Or any other way to convert the json file to readable csv format

0 Kudos
Manuel
Dataiker Alumni

Hi,

Are you able to upload your source file?

Does it create a dataset with one column and the data in json format?

You need this to do it in either Python or visually, but once you succeed with this, then you can simply use the unnest processor in a Prepare recipe.

I hope this helps

0 Kudos
SUSHIL
Level 3
Author

Hi, 

  • I can able to create dataset. 
  • How to use unest processor to prepare recipe. 
  • How to give input column . 
0 Kudos
Manuel
Dataiker Alumni

Hi,

In a prepare recipe, do "add a new step", search for Unnest. There is a field to indicate the column with the json.

See the example attached.

Best regards

 

0 Kudos
SUSHIL
Level 3
Author

Hi, 

I followed as per the screenshot

By using unnest process in recipe, still facing the error

The input column which given is not recognized. 

Pls find attached the screenshot of the issue

0 Kudos
Manuel
Dataiker Alumni

Hi,

From the screenshot, I notice two things you need to do differently:

  1. Your rows seem to have different parts of the JSONs. When you upload the file, you need to adjust the settings in the format/preview tab (see attached) to ensure you end up with one json per row
  2. Your column is not called json. In the unnest processor you need to use the name of that first column. I can't really see in the screenshot, but when uploading the file, you can name the column anything you want in the schema tab.

Best regards

0 Kudos
SUSHIL
Level 3
Author

Hi,  Thanks for  an input and guidance. now it's works fine. I can able to get results

Thank you

0 Kudos