Comments - JSON_VALID
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
Hello,
can you tell my, why the first select returns false and the second select true?
first select:
select json_valid('{"configuration":"{\"action\":\"reading\"}"}'); -- return 0
second select:
select json_valid(concat('{"configuration":', json_quote('{"action":"reading"}'), '}')); -- return 1
I can get the value for the first select from
select concat('{"configuration":', json_quote('{"action":"reading"}'), '}')
, which I use in the second select.Is it a bug?
I had tested it in MariaDB 10.2.13 and MariaDB 10.3.5.
Kind regards
K. Budde
You need to run this instead:
select json_valid('{"configuration":"{\\"action\\":\\"reading\\"}"}'); -- return 1