I have a table like this
| id | obj | |||
|---|---|---|---|---|
| 1 | {"is_from_shopping_bag":true,"products":[{"price":{"amount":"18.00","currency":"USD","offset":100,"amount_with_offset":"1800"},"product_id":"1234","quantity":1}],"source":"cart"} | |||
| 2 | {"is_from_shopping_bag":false,"products":[{"price":{"amount":"80.00","currency":"USD","offset":100,"amount_with_offset":"8000"},"product_id":"2345","quantity":1}],"source":"pdp"} | |||
I am doing a sql query in Hive to get the 'currency' field.
Currently I can run
SELECT
JSON_EXTRACT( obj, '$.products')
FROM my_table
Which returns
| obj | |||
|---|---|---|---|
| [{"price":{"amount":"18.00","currency":"USD","offset":100,"amount_with_offset":"1800"},"product_id":"1234","quantity":1}] | |||
| [{"price":{"amount":"80.00","currency":"USD","offset":100,"amount_with_offset":"8000"},"product_id":"2345","quantity":1}] | |||
How do I go a layer deeper to get the currency?