Export Wolfram Language expressions as JSON, UBJSON or ExpressionJSON.

To a File...

Write an expression to a JSON file:

If the filenames extension is not .json, specify the files type explicitly:

To a File as UBJSON...

Write an expression to a UBJSON file:

If the filenames extension is not .ubj, specify the files type explicitly:

  • UBJSON is a binary format that imitates and is compatible with JSON. It is more compact and more efficient than JSON, but not human readable.

To a File as ExpressionJSON...

Write an expression to an ExpressionJSON file:

  • ExpressionJSON provides lossless round-tripping of Wolfram Language expressions to and from JSON.

Notes

Use ExportString to export to a string rather than a file:
In[6]:=
Click for copyable input
Out[6]=
The output is a string:
In[7]:=
Click for copyable input
Out[7]=