Given a number of JSON document like this:
{
id: some_id,
l1: {
f1: [
{
c1: foo,
c2: bar
},
{
c1: foo1,
c2: bar1
}
],
f2: [
{
c3: baz,
c4: bar
}
]
}
}
How can I query MySQL 5.7 for f1....c1: foo1 -- ie lX is not given nor is the list position of the c1-c2 subdocument.
This is not a duplicate of Deep JSON query with partial path in PGSQL JSONB? since that is about PostgreSQL and this one is about MySQL.
SELECT JSON_EXTRACT(T.your_field, '$.l1.f1[1].c1'), JSON_EXTRACT(T.your_field, '$.l1.f1[2].c2'), ....;Full explited in MySQL docs, 11.6 The JSON Data Type