0

I have a JSON field ('ez_links') in a table ('bookings') and I wish to return a particular attribute/element ('Amount'), which represents the price of the booking.

In the example below, I want to return the value of '662', but NULL is returned.

select ez_links, ez_links-> 'Amount' AS price
FROM bookings
limit 1

Result:

ez_links price
{"integrator": "ezlinks", "TeeTimeReserveRecord": {"Fee": "Troon App Member", "Amount": "662",...........................................}} NULL

Thanks for your help.

1 Answer 1

2

This is a nested JSON, you can do the following to access the Amount field

SELECT ez_links->'TeeTimeReserveRecord'->'Amount' as price FROM bookings
limit 1                                                                                                                  ;

I hope this was helpful.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.