Module JSON.Convert

Author
Michael Hanus
Version
February 2025

This library defines a type class and instances for standard types to convert Curry values to JSON values and vice versa.

Exported Classes:

Exported Classes


class ConvertJSON a

The type class ConvertJSON defines conversion operations between values and their JSON representation. Since a JSON value might not contain a correct representation of a standard value, the operation fromJSON returns a Maybe value. The additional operations on value lists are used for a better JSON conversion of strings.

Methods:

toJSON :: a -> JValue  

Convert a value into its JSON representation.

fromJSON :: JValue -> Maybe a  

Convert a JSON representation into its corresponding value.

toJSONList :: [a] -> JValue  

Convert a list of values into its JSON rerpresentation. As a default, a JSON array is used to represent the list of values.

fromJSONList :: JValue -> Maybe [a]  

Convert a JSON representation into the corresponding list of values.