Atdgen uses type definitions in the ATD syntax and generates efficient JSON serializers, deserializers and validators for OCaml. Checkout the tutorial.