= The `JSONParser` structure
:Author: John Reppy
:Date: {release-date}
:stem: latexmath
:source-highlighter: pygments
:VERSION: {smlnj-version}

The `JSONParser` structure implements a parser for the
xref:str-JSON.adoc#type:value[`JSON.value`] type.

== Synopsis

[source,sml]
------------
structure JSONParser
------------

== Interface

[source,sml]
------------
val parse : TextIO.instream -> JSON.value

val parseFile : string -> JSON.value
------------

== Description

`[.kw]#val# parse : TextIO.instream \-> JSON.value`::
  `parse inS` parses a *JSON* value from the text-input stream `inS`.
  If there is a syntax error, then the
  {sml-basis-url}/general.html#SIG:GENERAL.Fail:EXN[`Fail`]
  exception is raised.

`[.kw]#val# parseFile : string \-> JSON.value`::
  `parse f` parses a *JSON* value from the text file `f`.
  If there is a syntax error, then the
  {sml-basis-url}/general.html#SIG:GENERAL.Fail:EXN[`Fail`]
  exception is raised.
  This function can also raise the
  {sml-basis-url}/io.html#SIG:IO.Io:EXN[`Io`] exception if
  there is an error opening `f`.

== See Also

xref:str-JSON.adoc[`JSON`],
xref:str-JSONSteamParser.adoc[`JSONStreamParser`],
xref:str-JSONUtil.adoc[`JSONUtil`],
xref:json-lib.adoc[__The JSON Library__]
