Bug #81331 MySQL Workbench exporting invalid JSON with "NULL" value
Submitted: 5 May 2016 22:59 Modified: 18 May 2016 20:11
Reporter: Juan Laporte Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:6.3.6 OS:MacOS (10.11.4)
Assigned to: CPU Architecture:Any
Tags: export, json

[5 May 2016 22:59] Juan Laporte
Description:
MySql Workbench 6.3.6 build 551 is exporting JSON with "null" value as "NULL". This needs to be resolved asap. Not good when I have to export 850000+ rows to json only for it to be invalid then needing to use a text editor to find and replace to correct the json and hope my PC/MAC doesn't crash in the process!!

How to repeat:
Set a value to a row/column as NULL and export to JSON. If you open the JSON file in an editor, it will indicate the NULL value as invalid.

Suggested fix:
set the workbench to export column/row with "NULL" value as "null"
[6 May 2016 10:05] MySQL Verification Team
Hello Juan Laporte,

Thank you for the report.
Observed this on Win7 with WB 6.3.6.

Thanks,
Umesh
[6 May 2016 10:06] MySQL Verification Team
-- How to repeat
-- CLI session

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> insert into t1(id) values(1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from t1;
+----+------+
| id | name |
+----+------+
|  1 | NULL |
+----+------+
1 row in set (0.00 sec)

-- WB session, export it as JSON

[
	{
		"id" : 1,
		"name" : NULL
	}
]

-- Try to validate above data

Error: Parse error on line 3:
...	"id": 1,	"name": NULL}]
---------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
[18 May 2016 20:11] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.3.7 release, and here's the changelog entry:

Exporting data to JSON was exporting NULL values as NULL instead of null,
thus breaking the JSON output.

Thank you for the bug report.
[22 Sep 2017 6:03] MySQL Verification Team
Bug #87828 marked as duplicate of this one