JSON SQL Examples

While lat/lon is stored in the location column as a Point, altitude is stored in a json array (along with lat/lon) in the latlngalt column.

A standard select query such as ‘select latlngalt from mytable’, latwould produce as below:

"{""latitude"":""41.7408504"",""longitude"":""87.9883978"",""altitude"":""327.3999938964844""}"

To query altitude value alone, use the json operators >> for text:

select latlngalt->>'altitude' from mytable;

Which produces the values for altitude as text.

To select the values as json, use the ‘short’ arrow

select latlngalt->>'altitude' from mytable;