'How to disable JSON escaping in H2 JSON field

The following code

DROP TABLE IF EXISTS  BBB;

CREATE TABLE BBB (id INT, data1 JSON, data2 TEXT);

insert into BBB (id, data1, data2) VALUES
(1, '{"a": 12}', '{"a": 12}');

SELECT *, CAST(data1 as TEXT) data3 FROM BBB;

causes different results in MySQL and H2.

In H2 it shows

enter image description here

while in MySQL it shows

enter image description here

I.e. H2 adds unneded escaping. How to (is it possible to) make H2 to behave the same as MySQL i.e. disable escaping of JSON fields?

Also workarounds with JPA/Hibernate are appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source