Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Import JSON

sdemichelis
7 - Meteor

Hi all,

 

I am trying to import a large file in JSON format. I have attached here a sample. I have tried to use the Json Parse tool but I get mostly blank fields. Is there a way to import this into a table format?

 

Thank you all for your help and suggestions

9 REPLIES 9
grazitti_sapna
17 - Castor

@sdemichelis, is this what you are trying to achieve?

Try reading the file in json format it will work.

grazitti_sapna_0-1655115391554.png

 

Thanks!

Sapna Gupta
sdemichelis
7 - Meteor

Dear Sapna,

 

it should be converted in table format. See attached

grazitti_sapna
17 - Castor

@sdemichelis, you will have to transform the data within alteryx workflow to achieve the result.

grazitti_sapna_0-1655118037865.png

 

I hope this helps!

 

Thanks!

Sapna Gupta
sdemichelis
7 - Meteor

Thank you. The layout is great and the rationale of your import is easy to follow. However, the test sample has more than one record. Why is alteryx limiting it?

apathetichell
19 - Altair

There's a variety of strategies to properly aggregate each JSON record into it's appropriate category. Usually there is a JSON record number which is included but in your case it isn't... I'd use a Multi-Row Formula to find if the category was a "company_number" (my assumption is this is your primary key) and if non exists - i'd take the previous row's company_number - this allows for a key column for your crosstab...

 

see attached.

grazitti_sapna
17 - Castor

@sdemichelis, the format of your JSON file is incorrect when I try to run it as ".json" file format in Alteryx. Please refer to the screenshot below.

grazitti_sapna_0-1655182359574.png

 

Then I checked this on JSON checker online and it showed me the exact error.

grazitti_sapna_1-1655182406921.png

 

The issue is a [ is missing in the beginning and ] at the end and after each record, it should be followed by a comma separator, in your scenario is it not able to distinguish between the records that is why it just read the first record. Attaching the correct JSON file.

Now if you want to keep the same JSON format as per the original file then you can use the below workflow.

 

Workflow 1

Use the following configuration

grazitti_sapna_3-1655184965026.png

 

Output

 

grazitti_sapna_2-1655184931695.png



Workflow 2(with correct JSON format file)

Use the JSON file attached along

grazitti_sapna_4-1655185369197.png

grazitti_sapna_5-1655185408673.png

 

Please let us know if it works for you!

 

Thanks!

 

 

 



 

Sapna Gupta
sdemichelis
7 - Meteor

Thank you

grazitti_sapna
17 - Castor

@sdemichelis, if this approach works for you could you please mark my post as a solution so that it could help others for future references.

 

Thanks!

Sapna Gupta
sdemichelis
7 - Meteor

Hi Sapna,

currently importing the full dataset. Will revert as soon as possible. Meanwhile, thank you for taking the time to assist

Stefano

Labels