This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

JSON (.json)

MIME type: .
Data interchange format.
Commonly used in web service implementations.
Contains collections of unordered name-value pairs or ordered values.
JSON is an acronym derived from JavaScript Object Notation.
Based on a subset of the JavaScript programming language.
Plain text format.
Developed in 2001.
Published as RFC 4627.
  • Import gives a rule-based representation of a JSON file.
  • Export exports a list of rules to JSON.
  • Import imports the specified element from a JSON file.
  • Import imports multiple elements.
  • Export creates a JSON file by treating expr as specifying element elem.
  • Export exports expr with the specified option elements taken to have the specified values.
  • Export uses rules to specify the elements to be exported.
  • See the main function pages for full general information on Import and Export.
"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 rules
  • Import by default uses the element.
  • When importing from JSON, lists are returned in standard Mathematica sorting order.
"Compact"Falsewhether to use line breaks to format file content
Import the contents of a JSON file:
Export a list of chemical elements and their properties to a JSON file:
Create a compact string representation of a JSON file:
Import the contents of a JSON file:
In[1]:=
Click for copyable input
Out[1]=
 
Export a list of chemical elements and their properties to a JSON file:
In[1]:=
Click for copyable input
Out[1]=
Create a compact string representation of a JSON file:
In[1]:=
Click for copyable input
Out[1]=