|
|
|
|
| Synopsis |
|
|
|
| Documentation |
|
| class TranslateField a where | Source |
|
| | Methods | | | By default, Haskell record field names are converted into
JSON object field names by stripping any initial underscores.
Specialize this method to define a different behavior.
|
|
|
|
|
Instances | |
|
|
|
| By default, Haskell record field names are converted into
JSON object field names by stripping any initial underscores.
Specialize this method to define a different behavior.
|
|
|
Removes initial underscores from a string.
New instances can be added to this class to customize
JSON serialization.
| | | Methods | | | | | You can specialize this method to prevent fields from being serialized.
The method should return a list of the Haskell names of the fields to
be excluded.
| | | | Types that will be converted to JSON arrays can override
this method to specify additional elements to be prepended to the array.
| | | | Types that will be converted to JSON arrays can override
this method to specify additional elements to be appended to the array.
| | | | Types that will be converted to JSON objects can override
this method to specify additional fields of the object.
|
| | Instances | | ToJson Bool | | ToJson Char | | ToJson Double | | ToJson Int | | ToJson Integer | | (Integral a, TranslateField a, Typeable a) => ToJson (Ratio a) | | (Typeable a, ToJson a) => ToJson (Maybe a) | | (ToJson a, TranslateField a, Data TranslateFieldD (Map String a)) => ToJson (Map String a) | | (ToJson a, ToJson b, TranslateField a, TranslateField b, Typeable a, Typeable b, Typeable2 Union) => ToJson (Union a b) |
|
|
|
|
Instances | |
|
|
|
|
|
| You can specialize this method to prevent fields from being serialized.
The method should return a list of the Haskell names of the fields to
be excluded.
|
|
|
| Types that will be converted to JSON arrays can override
this method to specify additional elements to be prepended to the array.
|
|
|
| Types that will be converted to JSON arrays can override
this method to specify additional elements to be appended to the array.
|
|
|
| Types that will be converted to JSON objects can override
this method to specify additional fields of the object.
|
|
|
| This is the implementation of toJson for the generic instance declaration,
but it's useful to be able to use the same implentation for
other instance declarations which override the default implementation
of exclude.
|
|
|
| This function can be used as an implementation of toJson for simple enums.
It just converts an enum value to a string determined by the name of the constructor,
after being fed through the (String -> String) function given as the first argument.
|
|
|
| A Haskell representation of a JSON
data structure.
| | Constructors | | Instances | |
|
|
|
| | Methods | | | | | In order to specify default values for required fields of a JSON object,
specialize this method in the instance definition for the relevant
datatype.
|
| | Instances | |
|
|
|
Instances | |
|
|
|
| In order to specify default values for required fields of a JSON object,
specialize this method in the instance definition for the relevant
datatype.
|
|
|
| Converts a String (interpreted as a true unicode String) to an instance
of JsonData.
|
|
|
| Converts a ByteString to an instance of JsonData (unicode encoding
is detected automatically).
|
|
|
|
|
| Converts a JSON String (interpreted as a true unicode string) to
a value of the type given by the first (dummy) argument.
|
|
|
| Converts a JSON ByteString (with unicode encoding automatically detected)
to a value of the type given by the first (dummy) argument.
|
|
|
|
|
| The counterpart of enumToJson.
|
|
|
| Converts a value to an ASCII-only JSON String.
|
|
|
|
|
|
|
| Use this for merging two or more records together.
Sensible instances of FromJson and ToJson are already defined for this type.
| | Constructors | | Instances | | Typeable2 Union | | (Data ctx a[a1B0], Data ctx b[a1B1], Sat (ctx (Union a[a1B0] b[a1B1]))) => Data ctx (Union a[a1B0] b[a1B1]) | | (Show a, Show b) => Show (Union a b) | | (FromJson a, FromJson b, Typeable a, Typeable b, TranslateField a, TranslateField b) => FromJson (Union a b) | | (ToJson a, ToJson b, TranslateField a, TranslateField b, Typeable a, Typeable b, Typeable2 Union) => ToJson (Union a b) |
|
|
|
|
| Nested Unions are left-branching by convention (since this is what you get
by using the constructor as an infix operator).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Produced by Haddock version 2.1.0 |