MySQL Forums
Forum List  »  General

Re: Using substr + SUBSTR MYSQL
Posted by: Peter Brawley
Date: November 11, 2021 02:54PM

The string looks like a JSON object with an extra trailing right curly brace and missing required surrounding single quotes ...

set @s='{"CreateDate":"2021-05-27T19:58:33","OrderKey":"6ea1eb40-bd80-4e8b-8e78-a7","OrderReference":"app_iheillyy_9816617_AF_e2002"}';

select json_type( @s );
+---------------+
| json_type(@s) |
+---------------+
| OBJECT        |
+---------------+

select json_extract(@s,"OrderKey");
+-------------------------------+
| json_extract(@s,"$.OrderKey") |
+-------------------------------+
| "6ea1eb40-bd80-4e8b-8e78-a7"  |
+-------------------------------+

See https://dev.mysql.com/doc/refman/8.0/en/json.html

Options: ReplyQuote


Subject
Written By
Posted
Re: Using substr + SUBSTR MYSQL
November 11, 2021 02:54PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.