How to extract values from JSON array field?

vicusbass
New Contributor II

Hi,

While creating an SQL notebook, I am struggling with extracting some values from a JSON array field. I need to create a view where a field would be an array with values extracted from a field like the one below, specifically I need the `value` field.

[{"sources": [{"providerIds": ["xx"], "source": "vendor", "status": "Verified", "type": "PersonalMobile", "updatedAt": {"$date": 1606563305398}}], "status": "Verified", "type": "PersonalMobile", "updatedAt": {"$date": 1606563305398}, "value": "+1-555-555"}, {"sources": [{"providerIds": ["xx"], "source": "vendor", "status": "Verified", "type": "PersonalMobile"}], "status": "Verified", "type": "PersonalMobile", "updatedAt": {"$date": 1606563305398}, "value": "+1-666-666"}]

I tried a few things:

SELECT [*].value from personalPhones
SELECT from_json(personalPhones:[*].value, 'string')
SELECT from_json(personalPhones:[*], 'value string'

It's syntax error OR invalid schema.

Any suggestions?