I would like to use a JSON path like $[*].name
or $[..].name
on a JSON like this one:
[
{"id": 1, "name": "John"},
{"id": 2, "name": "Mary"},
{"id": 3, "name": "Peter"}
]
To get as result:
["John", "Mary", "Peter"]
But when I try this on SQL Server 2019 using:
SELECT JSON_VALUE(json_data, '$[*].name')
FROM users
I got this error:
JSON path is not properly formatted. Unexpected character '*' is found at position 2.
So how can I get the expected result using a jsonpath
compatible with SQL Server?