OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Import the contents of a JSON file:

Import["ExampleData/temperatures.json"]

Export a list of chemical elements and their properties to a JSON file:

Export["elements.json",{"Hydrogen"->{"AtomicNumber"->1,"AtomicWeight"->1.00793`},"Helium"->{"AtomicNumber"->4.00259`,"AtomicWeight"->2},"Lithium"->{"AtomicNumber"->3,"AtomicWeight"->6.94141`},"Beryllium"->{"AtomicNumber"->4,"AtomicWeight"->9.01218`},"Boron"->{"AtomicNumber"->5,"AtomicWeight"->10.8086`},"Carbon"->{"AtomicNumber"->"6","AtomicWeight"->12.0107`}}]

OpenersExampleSection1(Spacer1)Scope  (1)

Create a compact string representation of a JSON file:

ExportString[{"Hydrogen"->{"AtomicNumber"->1,"AtomicWeight"->1.00793`},"Helium"->{"AtomicNumber"->4.00259`,"AtomicWeight"->2},"Lithium"->{"AtomicNumber"->3,"AtomicWeight"->6.94141`},"Beryllium"->{"AtomicNumber"->4,"AtomicWeight"->9.01218`},"Boron"->{"AtomicNumber"->5,"AtomicWeight"->10.8086`},"Carbon"->{"AtomicNumber"->"6","AtomicWeight"->12.0107`}}, "JSON","Compact"->True]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {Related Formats:  (RefLink[RawJSON, paclet:ref/format/RawJSON])  ▪  (RefLink[ExpressionJSON, paclet:ref/format/ExpressionJSON])  ▪  (RefLink[UBJSON, paclet:ref/format/UBJSON])  ▪  (RefLink[BSON, paclet:ref/format/BSON])  ▪  (RefLink[XML, paclet:ref/format/XML])  ▪  (RefLink[ExpressionML, paclet:ref/format/ExpressionML])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Basic Formats, paclet:guide/BasicFormats])}, {▪(RefLinkPlain[Importing and Exporting, paclet:guide/ImportingAndExporting])}, {▪(RefLinkPlain[Listing of All Formats, paclet:guide/ListingOfAllFormats])}, {▪(RefLinkPlain[Systems & Utility Formats, paclet:guide/SystemsAndUtilityFormats])}, {▪(RefLinkPlain[Web Formats, paclet:guide/WebFormats])}, {▪(RefLinkPlain[Web Operations, paclet:guide/WebOperations])}})}})