DEV Community

Tim Nguyen
Tim Nguyen

Posted on • Edited on

MySQL syntaxes

What

👎 JSON_UNQUOTE + JSON_EXTRACT vs 👍 ->>



SELECT JSON_UNQUOTE(JSON_EXTRACT(metadata, 'field')) 👎
SELECT metadata->>'$.field' 👍

Enter fullscreen mode Exit fullscreen mode




Why it matters?

JSON_EXTRACT vs -> only return the json result
JSON_UNQUOTE + JSON_EXTRACT vs ->> return the parsed result (you can think of the JSON.parse method in JS)

Top comments (0)