# Module Pa_deriving_Json

    module Pa_deriving_Json: sig .. end

Deriving_json syntax extension (based on the deriving library).
See also

- the source code of deriving
- the documentation of the original deriving library by Jeremy Yallop.

`type typ = .. deriving (Json)` with generate

    module Json_typ : sig

      type a = typ

      val to_string : a -> string

      val from_string : string -> a

      ...

    end

    val register_predefs : Pa_deriving_common.Type.qname -> Pa_deriving_common.Type.qname -> unit

`register_predefs typeA typeB` tells the syntax extension that `typeB` is an alias for `typeA`. The extension syntax will then use the deriving_json implementation of `typeB` in place of `typeA`'s one.

Important note: TypeB does NOT HAVE TO actually exists.

In practive, you may need to use this in the following cases:

- use deriving_json on types from external libraries that do not use deriving
- use deriving_json on abstract types