Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

Parser

Tutorials

  • Building Language Front-Ends
  • Inside CodeAnalysis - How CodeStructure Parses C
  • Design and Compilation Strategy
  • Implementing the LaTeX Math Parser
  • MaTeX Comparison Showcase
  • The Parser Landscape - a Survey of What Exists Today
  • The Parser Zoo - language front-ends over a shared algebra
  • Parsing BNF Grammars (and bootstrapping a TPTP parser)
  • Parsing GrammarRules Locally
  • A Markdown Inline Parser in Parser Combinators
  • ParsingOpenQASM
  • Parsing TPTP, Auto-Generated from the Published BNF
  • PrattVsPEG
  • The Wolfram Box Typesetting Reference

Guides

  • Parsing in the Wolfram Language

Symbols

  • ASTAddSource
  • ASTAlgebra
  • ASTContainer
  • ASTLeafQ
  • ASTNodeQ
  • ASTStripSource
  • BinaryNode
  • BrainfuckAST
  • BrainfuckGrammar
  • BrainfuckRun
  • BrainfuckSemantic
  • CalculatorAST
  • CalculatorEval
  • CalculatorGrammar
  • CalculatorSemantic
  • CallNode
  • ContainerNode
  • EBNFParse
  • EBNFRules
  • ErrorNode
  • ExportLaTeX
  • GroupNode
  • InfixNode
  • JSONAST
  • JSONGrammar
  • JSONImport
  • JSONSemantic
  • LambdaAST
  • LambdaEval
  • LambdaGrammar
  • LambdaSemantic
  • LaTeXMathParse
  • LaTeXMathParser
  • LaTeXMathStyle
  • LeafNode
  • LispAST
  • LispGrammar
  • LispRead
  • LispSemantic
  • LispSymbol
  • MarkdownInlineParse
  • MarkdownInlineParser
  • MarkdownParse
  • MarkdownParser
  • ParseAction
  • ParseBetween
  • ParseChainLeft
  • ParseChainRight
  • ParseCharacter
  • ParseChoiceLongest
  • ParseChoice
  • ParseFail
  • ParseLiteral
  • ParseLookahead
  • ParseMany
  • Parse
  • ParseNotFollowedBy
  • ParseOperatorTable
  • ParseOptional
  • ParsePartial
  • ParsePosition
  • ParserCombinator
  • ParserCombinatorQ
  • ParserCompile
  • ParseRecursive
  • ParseRegex
  • ParseSepBy1
  • ParseSepBy
  • ParseSequence
  • ParseSome
  • ParseSucceed
  • ParseTry
  • PostfixNode
  • PrefixNode
  • RecCell
  • RecRef
  • SetRec
  • SpannedToken
  • TernaryNode
  • ToCodeParser
  • TPTPExport
  • TPTPImport

Overviews

  • WolframParser
Wolfram`Parser`Languages`JSON`
JSONAST
​
JSONAST
[json]
parses the JSON string json to a standard syntax tree - a
ContainerNode
of
GroupNode
,
BinaryNode
and
LeafNode
.
​
Details and Options
▪
JSONAST
is the standard-AST mode of the JSON grammar: it runs
JSONGrammar
over a tree-building algebra, so the result carries no native value, only structure.
▪
A JSON object is a
"Object"
GroupNode
; a JSON array is an
"Array"
GroupNode
; each object member is a
":"
BinaryNode
pairing the key leaf with the value.
▪
A
LeafNode
keeps the literal source text, including the surrounding quotes of a string (
"\"a\""
, not
"a"
) and the raw digits of a number (
"42"
, not
42
); values are only interpreted in the
JSONImport
mode.
▪
Number leaves are tagged
"Integer"
or
"Real"
from the literal form - a decimal point or exponent makes it
"Real"
.
▪
Every node carries a
"Source"
span in its metadata, a
CodeParser
line-column pair
{{startLine,startCol},{endLine,endCol}}
. A leaf spans its own text; a
GroupNode
spans its content (the brackets themselves are not included), so a multi-line input gives a span whose endpoints sit on different lines.
▪
JSONImport
runs the same
JSONGrammar
over
JSONSemantic
instead, folding to a native Wolfram value. The grammar is written once; only the algebra differs.
▪
Input that does not parse to completion returns a
Failure
(see
Parse
).
​
Examples  
(4)
Basic Examples  
(1)
An object is a
"Object"
GroupNode
of
":"
BinaryNode
members:
In[1]:=
JSONAST
["{\"a\": [1, true]}"]
Out[1]=
ContainerNode[String,{GroupNode[Object,{BinaryNode[:,{LeafNode[String,"a",Source{{1,2},{1,5}}],GroupNode[Array,{LeafNode[Integer,1,Source{{1,8},{1,9}}],LeafNode[Boolean,true,Source{{1,11},{1,15}}]},Source{{1,8},{1,15}}]},Source{{1,2},{1,15}}]},Source{{1,2},{1,15}}]},Source{{1,2},{1,15}}]
An array is a
"Array"
GroupNode
:
In[2]:=
JSONAST
["[1, 2]"]
Out[2]=
ContainerNode[String,{GroupNode[Array,{LeafNode[Integer,1,Source{{1,2},{1,3}}],LeafNode[Integer,2,Source{{1,5},{1,6}}]},Source{{1,2},{1,6}}]},Source{{1,2},{1,6}}]
The same source through
JSONImport
is a native value, not a tree:
In[3]:=
JSONImport
["{\"a\": [1, true]}"]
Out[3]=
a{1,True}
Scope  
(1)

Properties & Relations  
(1)

Possible Issues  
(1)

SeeAlso
JSONImport
 
▪
JSONGrammar
 
▪
JSONSemantic
 
▪
GroupNode
 
▪
BinaryNode
 
▪
LeafNode
 
▪
ASTAlgebra
RelatedGuides
▪
ParserZoo
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com