From JSON to Google Spreadsheets

Hi there!

I’m trying to get a list of items from an auction site and save them into a google spreadsheet. In the last part of the process, when I need to iterate over the JSON values, I’m not getting the expected result (see step 5)

These are the steps I’m executing

1) HTTP request to get the HTML from the page. In that HTML there’s a JSON embedded


2) I use a regex to extract the JSON from the HTML (screenshot)


3) I use Parse to JSON to convert the string from the regex Fallback Match. In the images you can see the config and the results (I expanded one of the groups to show the example values I have in there).
Important note here: it seems the data in the JSON is formatted with a unique name for each node (“AuctionLot.8935”, “AuctionLot.8634”, etc), and this probably affects the following steps


4) I use an iterator to bring into a new JSON (or is it an array in this case?) with ONLY the nodes that I need. As a result, I get 1 bundle per node (I expanded one of the groups to show the example values I have in there)


5) In this step is where I don’t know what’s happening.
I added a “Set multiple variables” just as an audit point to try to see if I can iterate throu the bundles of the previous step, but the only option I have when configuring it is “Values” and not the specific fields inside of the bundles/nodes (see image 1) while I should see something like the second image. For example, I’d like to use the field “auction_lot_id”


What can I do in order to iterate on step 5 throu each Bundle so I can have N rows (one per each bundle) as a result?

Any ideas/suggestions are more than welcome!

thanks

Hi @barbeta

Please provide an example of the JSON output that you get from the Parse JSON module.

  1. To do that, simply insert the Value variable into a “Set Variable” module.

  2. Alternatively, you can type out the collection properties manually like this:

    e.g.: (type or paste each row into the respective fields, including the {{ }} brackets)

    {{ 43.auction_id }}
    {{ 43.auction_lot_id }}
    {{ 43.description }}
    {{ 43.lot_number }}
    
    ... etc.
    

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

Sure thing:
json output.txt (558.9 KB)

So, the first option (using a “set variable” module) didn’t work.
This is the config I’ve used:

and this is the result:

BUT, the second option did work in part: it returned the values of the “Bundle 1”.
This is the setup:

And this was the result:

The tricky part is how to make it iterate through all the Bundles in a scalable way (not entering the mapping 1 by 1)

thanks!

What if you used a “Set Multiple Variables” module with each value as a separate variable?

You only need to do this once.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

1 Like