How to store JSON nested Array In DB

Six Stars

How to store JSON nested Array In DB

Hi All,

 

I have a requirement that gets the response from web API and inserts that response in DB. And getting response in JSON with nested array.

this is my JSON response:

{
"order": {
"id": 445157867567,

"tax_lines": [{
"price": "4.00",
"rate": 0.04,
"title": "NY STATE TAX"
}, {
"price": "4.50",
"rate": 0.045,
"title": "NY CITY TAX"
}, {
"price": "0.38",
"rate": 0.00375,
"title": "NY SPECIAL TAX"
}],

}
}

 

Need to insert that data into like this:

order_id,price,rate,title

445157867567, 4.000000 ,0.040000 ,NY STATE TAX

445157867567, 4.500000 0.045000 NY CITY TAX

445157867567, 0.380000 0.003750 NY SPECIAL TAX

 

My Job process snap attached, Can someone tell me where I'm doing wrong.

 

Json_Response.PNG


Accepted Solutions
Twelve Stars

Re: How to store JSON nested Array In DB

You can change JSONPath to XPath and use parent operator

 

../id 

 

some information about XPath vs JSONPath - http://goessner.net/articles/JsonPath/

-----------

All Replies
Twelve Stars

Re: How to store JSON nested Array In DB

You can change JSONPath to XPath and use parent operator

 

../id 

 

some information about XPath vs JSONPath - http://goessner.net/articles/JsonPath/

-----------
Six Stars

Re: How to store JSON nested Array In DB

Thanks @vapukov Smiley Happy