A "JSON document", here, is described as:
For convenience, even though it's not in the JSON spec, I have included ISO8601 timestamp values as a "JSON property type".
A JValue represents a typed value within a JSON document.
A JProp represents the type of a scalar property within a JSON document. These are regarded separately
from the JValue type for a few important reasons:
In order to create a distinction between "a parsed JSON value" and "a reference to a location within a JSON document", it must be the case that we have another way to represent the concept of "the expected type of a value at a location within a JSON document" that is separate from "a value at a location within a JSON document, from which the type is derived".
Creating a second type was the most straightforward way to implement this behavior.
A JStructure represents a property that has a structural type (i.e., a list or an object) within a JSON document.
A Keypath is a data structure that stores the JSON path to a value of a given key.
Elements in a Keypath are either the name of a field, or the index of an array.
Use the functions in the Json.InElm.Keypath module to work with Keypath values.
A JTag is a "tag" that is used to store the type of a given property (scalar or structural) in a JSON document.
Json.InElm doesn't actually need to store this information in order to parse a JSON document, since it can be inferred directly from incoming data; however, it can be helpful to store this information for later retrieval and evaluation, so a type JTag that unions JProps and JStructures is provided.
A Schema describes the type of, and path to, a given Node.
Parse a Json.Decode.Value to a Node.
Parse a Json.Decode.Value to a Node, at a given KeyPath.
Parse a raw JSON string to a Node.
Create a decoder to a Node, given a Keypath.
JValueFrom a Node, get all possible Nodes.
Try to get a List (String, Node) from a JValue, where the String
value is the name of the field in the object.
NodeCombinator that allows you to build a view function that renders a Node; i.e., if you can provide all of the functions
to destructure a Node, we can display it for you!
A
Nodeis a reprentation of part of a JSON document, along with everything that is inside of it, along with its "key path", which is its location within a JSON document.This means that the output of the parser will always be a single
Node; but depending on the input, thatNode'sJValuemay have otherNodes inside of it.