Bug #90270 HTML UTF8 encoded values in JSON field break Value Editor association as JSON
Submitted: 31 Mar 2018 13:08 Modified: 4 Apr 2018 11:37
Reporter: Anrii Pertsiukh Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S5 (Performance)
Version:6.3.10 OS:Linux (LinuxMint 18 x86_64)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[31 Mar 2018 13:08] Anrii Pertsiukh
Description:
Correct JSON in LONGTEXT field with HTML UTF8 encoded text in value break association of the hole field as JSON. No JSON tab in editor.

If JSON Value field contains backslashed encoding of UTF8 symbol, for example, like \u0434 there are will be no JSON tab in Value Editor, only Binary and Text tabs.

How to repeat:
Save next example text in LONGTEXT field:
{"sender_first_name":"\u0434\u043e\u043c\u0435\u043d","sender_last_name":"\u0434\u043e\u043c\u0435\u043d"}

Then SELECT this field and open it by right click and choosing "Open Value in Editor". Take a look on the top right tab selector. There are will be no JSON tab.
[3 Apr 2018 11:39] Chiranjeevi Battula
Hello Anrii Pertsiukh,

Thank you for the bug report.
Could you please provide repeatable steps (exact steps, create table script, table data etc. - please make it as private if you prefer) to confirm this issue at our end?

Thanks,
Chiranjeevi.
[3 Apr 2018 21:27] Anrii Pertsiukh
USE `prototype_1`;

CREATE TABLE `prototype_1`.`json_test_table` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `ts` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP(),
  `json_longtext_field` LONGTEXT NULL,
  `json_field` JSON NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4;

INSERT INTO `prototype_1`.`json_test_table` (`json_longtext_field`, `json_field`) VALUES ('{\"sender_first_name\":\"\\u0434\\u043e\\u043c\\u0435\\u043d\",\"sender_last_name\":\"\\u0434\\u043e\\u043c\\u0435\\u043d\"}', '{\"sender_first_name\":\"\\u0434\\u043e\\u043c\\u0435\\u043d\",\"sender_last_name\":\"\\u0434\\u043e\\u043c\\u0435\\u043d\"}');

INSERT INTO `prototype_1`.`json_test_table` (`json_longtext_field`, `json_field`) 
VALUES (JSON_OBJECT('sender_first_name', '\u0434\\u0435'), JSON_OBJECT('sender_first_name', '\u0434\\u0435'));

UPDATE `prototype_1`.`json_test_table` SET `json_field`='{\"sender_first_name\": \"\\u0434\\u0435\"}' WHERE `id`='2';

SELECT * FROM `prototype_1`.`json_test_table`;

Now, just look each field in Value Editor.
[4 Apr 2018 11:37] Chiranjeevi Battula
Hello  Anrii Pertsiukh,

Thank you for the feedback.
Verified this behavior on MySQL Workbench in 6.3.10 version.

Thanks,
Chiranjeevi.