Hello,
I am fairly new to Alteryx. Is there a way to combine multiple json files to be parsed into a single output like a CSV file or hyper file for Tableau?
In the attached workflow, the top line is running correctly for a single json file. I tried replicating it in so that it is looking at a directory instead on the second line where I will be storing multiple json files. However, I'm not quite sure how to complete the flow. Any help would be greatly appreciated!
Solved! Go to Solution.
Hi @synergy825
Try to replace the file by files\*.json. Be sure to keep the same delimiter and the rest of the config.
Thank you @binuacs and @Felipe_Ribeir0 !
@synergy825 Great idea using the directory tool. You can certainly continue with your thought process. You just need to tweak a few things to get it up and running. The directory tool will provide you with data about your files, depending on where you are pointing it. You want to point the directory to the folder that contains the multiple JSON files you mentioned. This tool will go into that folder, and find the files and information related to those files for you. This is useful, as we can use the FullPath information that the directory tool will give us. Therefore, we can pull those files into our Alteryx workflow as we have their FullPaths.
One caveat to using the directory tool. BE CAREFUL. If you are pointing it to a folder which has loads of .json files, it can potentially pick all of those up. I would recommend creating a new folder and moving the .json files into that folder (for simplicity sake).
We use *.json in the File Specification. This means, pick up anything in this folder which is the file type .json ..
I created a few copies of the JSON file you gave for demo purposes. See below, I have 3 json files in the folder I pointed it to:
Now we want to bring in each of these files, one after the other. Essentially completing the workflow for one, bringing in the next file, completing the workflow for that one, and then appending it to the bottom. This process can be completed by using a Batch macro i.e. doing it in batches.
I created a batch macro for you, leveraging the workflow you gave. In here, it basically says we will only process one of those files from the directory at a time.
This is the final product below. Make sure you change the field highlighted in yellow (top left). On the control parameter configuration to FullPath. Just as a check, we can see 114846 records. Which is your output from your previous one tripled. Hopefully this helps! Definitely have a look into batch macros.
Thank you @BS_THE_ANALYST ! for the detailed explanation. This was very helpful!