Exporting data to JSON¶
Export the contents of a data grid to a JSON file — convenient for feeding data to web applications, APIs, and scripts.
To export a grid to JSON:
- Right-click the grid and choose Export to JSON.
- In the JSON export options dialog, name the destination file, set the options described below, and click OK.
The options¶
JSON values decides what to do with a value that is itself JSON — text that holds a JSON document, or a JSONB column.
- Embedded in the file — a JSON object or array becomes part of the file, so it reads as JSON rather than as a string of escaped quotes or a block of base64. What this gives up is the layout of the original text, and for a JSONB value the storage form; both are worked out again on the way back in.
- As JSON-escaped strings — every such value is written as a string, with its quotes escaped: for a text column the characters it holds, exactly; for a JSONB column the JSON its bytes encode.
Only an object or an array is ever embedded. A number in a text column would come back a number, and a JSON string is the text of the column already, so neither is touched.
Include BLOB columns writes blob values as base64. With it off, the columns
are left out of the file altogether — not written empty, but absent from the
columns list and from every row.
Format JSON lays the file out over several lines and indents it, the way the JSON editor's Format button does. Turn it off for a smaller file.
Tip
A file exported with Include BLOB columns on can be read straight back by Importing data from a file — the file carries its own column list, so nothing is guessed on the way in.
See also: Importing data from a file · Exporting data to XML · Exporting data to HTML