Question

How to Parse JSON objects?

  • 24 May 2022
  • 1 reply
  • 7197 views

Hello all, I’m trying to use data coming from a JSON file but I cannot find the right way to do so. 

I’m struggling on how the data is coming from another tool and make it available to use.

 

JSON I’m getting looks like this

{
"headings":
[{"name":"KEY","table":"SQL","type":"STRING"},{"name":"CREATED","table":"SQL","type":"DATE"},{"name":"REG_PLATE","table":"SQL","type":"STRING"},{"name":"MAKE_SLUG","table":"SQL","type":"STRING"},{"name":"CANONICAL_MODEL_SLUG","table":"SQL","type":"STRING"},{"name":"MODEL_SLUG","table":"SQL","type":"STRING"},{"name":"MODEL_NAME","table":"SQL","type":"STRING"},{"name":"PRICE","table":"SQL","type":"INT"},{"name":"MARKET_VALUE","table":"SQL","type":"INT"},{"name":"MILEAGE","table":"SQL","type":"INT"},{"name":"MODEL_YEAR","table":"SQL","type":"STRING"},{"name":"REG_YEAR","table":"SQL","type":"INT"},{"name":"COLOUR","table":"SQL","type":"STRING"},{"name":"GENERIC_COLOUR","table":"SQL","type":"STRING"}],
"rows": [
{"cells":["AAAA","2022-05-01","AAAA","Ford","fiesta-active","fiesta-active","Fiesta Active","14499","16320","2834","2019","2019","Metallic - Moondust silver","Silver"]}
,{"cells":["BBBB","2022-05-01","BBBB","MINI","3-door-hatch","3-door-hatch-2018","3-Door Hatch","14500",null,"12464","2019","2019","Metallic - Starlight blue","Blue"]}
]
}

And what I’m trying to do is to have

KEY: "AAAA"
CREATED:"2022-05-01"
REG_PLATE:"AAAA"
MAKE_SLUG:"Ford"
CANONICAL_MODEL_SLUG:"fiesta-active"
MODEL_SLUG:"fiesta-active"
MODEL_NAME:"Fiesta Active"
PRICE:"14499"
MARKET_VALUE:"16320"
MILEAGE:"2834"
ODEL_YEAR:"2019"
REG_YEAR:"2019"
COLOUR:"Metallic - Moondust silver"
GENERIC_COLOUR:"Silver"

So each one of the names are a column and the rows stay as rows so I can pass this to a google/sheet.


I’ve been looking at several related posts but I’m not being able to find anything related.

Any help please


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +14

Hi @agarbre 

Good question.

You’ll need a custom Code step configured to parse and prep the data into the desired format.

Consider hiring a Zapier Expert for help: https://zapier.com/experts