Bug #71846 MySQL Workbench JSON export does not export valid JSON
Submitted: 26 Feb 2014 15:33 Modified: 24 May 2018 15:28
Reporter: James Fisher Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.38, 6.0.9, 6.1.1 OS:Any
Assigned to: CPU Architecture:Any

[26 Feb 2014 15:33] James Fisher
Description:
After performing a query, there is an option to export the result set. Various formats are supported. One of these is "JSON". However, exporting as "JSON" produces a file which is not valid JSON. Specifically, JSON strings use double-quotes as delimiters, but all strings in the exported file (object keys and string literals) use single quotes.

(Additionally, it appends ".js" to the chosen filename, which is probably not desired; ".json" is standard.)

How to repeat:
1. Perform a query.

2. Click the "Export" button.

3. Choose "JSON" as the export type.

4. Choose a filename to export to.

5. Click "Save".

6. Open the exported file.

Suggested fix:
Change double-quotes to single-quotes as string delimiters.
[26 Feb 2014 15:37] James Fisher
Additionally, NULL values are exported as the literal "NULL", but this is not a valid JSON value. There is a valid JSON value "null", however.
[26 Feb 2014 17:13] MySQL Verification Team
Hello James,

Thank you for the bug report.
Verified as described.

** All strings in the exported file use single quotes.
** The file type/extension for JSON files is ".json", but exported file end up as .js

Thanks,
Umesh
[4 Mar 2014 12:54] Miguel Tadeu Mota
Changed the file extension and the the string representation. Seems to be ok, 
now.
[13 Mar 2014 2:50] Philip Olson
Fixed as of the upcoming MySQL Workbench 6.1.3 release, and here's the changelog entry:

Exported JSON string delimiters used double quotes instead of single
quotes, and the exported JSON file extension changed from ".js" to
".json".

Thank you for the bug report.
[2 Mar 2015 12:06] Jurriƫn Dokter
I'm working on Mysql Workbench 6.2.4.12437 build 2426 (win7, 64bit). When exporting a JSON file I get a result like this : http://pastebin.com/i8ZHsd1G

The problems:

- a question mark is used as value, which is not a valid value
- keys are not enclosed with double quotes, but with single quotes

Thirtiary problem, but that's related to the query, is that certain fields are existing multiple times (in this example 'aoprodid')
[2 Mar 2015 12:10] Marcin Szalowicz
Thank you for the bug report.
[16 Apr 2015 14:29] Alexander Michels
As of version 6.2.5.0 build 397 this still does not output valid JSON. There is a very clearly defined specification for what is considered valid JSON at http://json.org
[5 May 2016 22:52] Juan Laporte
MySql Workbench 6.3.6 build 551 is still 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!!