hw-json-1.3.2.4: Memory efficient JSON parser
Safe HaskellSafe-Inferred
LanguageHaskell2010

HaskellWorks.Data.Json.Value

Synopsis

Documentation

data JsonValue Source #

Traditional JSON type.

This type has the a constructor per JSON data type as is typical for JSON in most libraries.

See jsonValueAt on how to parse JSON text into this datatype.

Although Haskell data types are lazy by default, you will not get a fully lazy data structure when parsing to this type because there is no way to express parsing errors in this datatype.

For a data type that gives you lazier behaviour, see other alternatives such as JsonPartialValue or LightJson.

class JsonValueAt a where Source #

Methods

jsonValueAt :: a -> Either DecodeError JsonValue Source #

Get a JSON value from another type

The hw-json library does not do full JSON validation for efficiency reasons, but parsing can fail if the JSON is malformed. When parsing fails, then Left will be returned.

If Right is returned then that means there are no parsing failures, which implies "knowing" that there parsing failures in the entire document, which implies that pattern matching on Right evaluates the entire document.

This limits the laziness of the JSON parsing. For lazier alternatives, see jsonPartialJsonValueAt or lightJsonAt.

Instances

Instances details
JsonValueAt JsonIndex Source # 
Instance details

Defined in HaskellWorks.Data.Json.Value