How to insert json nested data into mysql table?

I am trying to update mysql table and insert jsondata into mysqltable column json-datatypeusing JSON_INSERT. Here is the structure of my column.

{
"Data": 
     [{
      "Devce": "ios", 
      "Status": 1
      }]
}

This is the query that I use for insertadditional data in this field.

UPDATE table SET `Value` = JSON_INSERT
(`Value`,'$.Data','{\"Device\":\"ios\",\"Status\":1}') WHERE Meta = 'REQUEST_APP'

It is supposed to update the field to this:

{
    "Data": 
         [{
          "Devce": "ios", 
          "Status": 1
          },
    {
          "Devce": "ios", 
          "Status": 1
          }
]
    }

But instead, the result is:

0 rows affected. (The request took 0.0241 seconds.)

Any help in this regard would be appreciated.

+4
source share
1 answer

JSON_APPENDserves for your purpose better JSON_APPEND docs

+2
source

Source: https://habr.com/ru/post/1684457/


All Articles