Code representation format for the JavaScript programming language.
    JavaScriptExpression is the same as the format RawJSON.
    MIME type: application/json.
    Data interchange format.
    JavaScriptExpression supports full JSON syntax but uses a specific interpretation.
    JavaScriptExpression identifies JSON objects with Wolfram Language associations.
    JSON is commonly used in web programming.
    JSON is an acronym derived from JavaScript Object Notation.
    JSON is based on a subset of the JavaScript programming language.
    Plain text format.
    JSON was developed in 2001.
    JSON is published as RFC 4627.

Import and Export

  • Import["file","JavaScriptExpression"] imports a JSON file as a combination of nested lists and associations.
  • ImportString["string","JavaScriptExpression"] imports a JSON string.
  • Export["file",expr,"JavaScriptExpression"] exports a combination of nested lists and associations to a JSON file.
  • ExportString[expr,"JavaScriptExpression"] exports to a JSON string.
  • See the main function pages for full general information on Import and Export.
  • ImportString and ExportString support the RawJSON data format.


  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties and settings
  • Data representation element:
  • "Data"contents of a JSON file as nested lists or associations
  • Import uses the "Data" element by default.
  • The "JavaScriptExpression" format identifies JSON objects of the form {field1:value1,field2:value2,} with associations of the form <|"field1"->value1,"field2"->value2,|> in the Wolfram Language.
  • "JavaScriptExpression" identifies JSON lists [e1,e2,] with Wolfram Language lists {e1,e2,}.
  • Strings in the Wolfram Language are represented in JavaScriptExpression as UTF-8 strings, escaped as required by the JSON standard.
  • Numbers where scientific notation is used are given in JavaScriptExpression in E notation.
  • The symbols True and False are represented in RawJSON as the values true and false.
  • The symbol Null is represented as the JSON value null.


  • Export options:
  • "Compact"Falsewhether to omit line breaks and tabs
    "ConversionFunction"Nonefunction to apply for additional conversions
    "ConversionRules"{}rules to apply to override or add conversions
  • The setting for "ConversionRules" is used to replace subexpressions before built-in conversions are performed.
  • The setting for "ConversionFunction" is applied to subexpressions for which no built-in conversion is defined.
  • "Compact"->n includes line breaks and tabs up to indent level n.


Basic Examples  (3)

Import a JavaScript list:

Click for copyable input

Give a string consisting of a JavaScript object:

Click for copyable input

Importing this string gives an association:

Click for copyable input

Import a JavaScript expression from ExternalEvaluate using Node.js:

Click for copyable input

Confirm that it is the same as using the "ReturnType" of "Expression":

Click for copyable input

Evaluate a JavaScript object with ExternalEvaluate and import it as an association:

Click for copyable input
Introduced in 2017