title: How to get data from json in a mysql query correctly?
body: <p>I'm trying to pull data from json and insert it into a table. New rows appear in the table by number as in json, but all fields have an empty value, NULL. Please help me figure it out.</p>
  <pre><code>[{&quot;name&quot;:&quot;ivan&quot;,&quot;city&quot;:&quot;london&quot;,&quot;kurs&quot;:&quot;1&quot;},{&quot;name&quot;:&quot;lena&quot;,&quot;city&quot;:&quot;tokio&quot;,&quot;kurs&quot;:&quot;5&quot;},{&quot;name&quot;:&quot;misha&quot;,&quot;city&quot;:&quot;kazan&quot;,&quot;kurs&quot;:&quot;3&quot;}]
  
  SET @json = CONVERT(LOAD_FILE('/var/lib/mysql-files/myfile.json') using utf8mb4);
  REPLACE INTO test (name, city, kurs)
  SELECT   
    JSON_VALUE(@json, '$.name') as name,
    JSON_VALUE(@json, '$.city') as city,
    JSON_VALUE(@json, '$.kurs') as kurs
  FROM JSON_TABLE(@json,'$[*]' COLUMNS (data JSON PATH '$')) jsontable
  </code></pre>
  <p><a href="https://i.stack.imgur.com/JpHJj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JpHJj.png" alt="enter image description here" /></a></p>