If I do: SELECT JSON_REMOVE(@I, '$.friends[*].name');
OR SELECT JSON_REMOVE(@I, '$.friends[*].friends');
on the JSON below, I get this this error:
ERROR 3149 (42000): In this situation, path expressions may not contain the * and ** tokens.
JSON:
SET @I = '{
"name": "Alice",
"friends": [
{
"name": "Bob",
"friends": [
{
"name": "Carl",
"friends": []
},
{
"name": "Danny",
"friends": []
}
]
},
{
"name": "Edward",
"friends": [
{
"name": "Frank",
"friends": []
},
{
"name": "Gary",
"friends": []
}
]
}
]
}';
However if I do SELECT JSON_EXTRACT(@I, '$.friends[*].friends')
it returns the results fine.
[[{"friends": [], "name": "Carl"}, {"friends": [], "name": "Danny"}], [{"name": "Frank", "friends": []}, {"name": "Gary", "friends": []}]]
Basically I want to return a string with all friends.name
removed and maybe even friends.friends
removed.