The json-autotype package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Generates datatype declarations with Aeson's FromJSON instances from a set of example .json files.

To get started you need to install the package, and run json-autotype binary on an input .json file. That will generate a new Aeson-based JSON parser.

$ json-autotype input.json -o JSONTypes.hs

Feel free to tweak the by changing types of the fields - any field type that is instance of FromJSON should work.

You may immediately test the parser by calling it as a script:

$ runghc JSONTypes.hs input.json

See introduction on https://github.com/mgajda/json-autotype for details.


[Skip to ReadMe]

Properties

Versions0.2.0.0, 0.2.1.0, 0.2.1.1, 0.2.1.2, 0.2.1.2, 0.2.1.3, 0.2.1.4, 0.2.2.0, 0.2.3.0, 0.2.4.0, 0.2.5.0, 0.2.5.1, 0.2.5.2, 0.2.5.3, 0.2.5.4, 0.2.5.6, 0.2.5.7, 0.2.5.8, 0.2.5.9, 0.2.5.10, 0.2.5.11, 0.2.5.12, 0.2.5.13, 0.3, 0.4, 0.5, 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.0.10, 1.0.11, 1.0.12, 1.0.13, 1.0.14, 1.0.15
Change logchangelog.md
Dependenciesaeson (>=0.7 && <0.9), base (>=4.3 && <4.8), bytestring (>=0.9 && <0.11), containers (>=0.3 && <0.6), filepath (==1.3.*), hashable (==1.2.*), hflags (==0.4.*), lens (>=4.1 && <4.5), MissingH (==1.2.*), mtl (==2.1.*), text (>=1.1 && <1.3), uniplate (==1.6.*), unordered-containers (==0.2.*), vector (>=0.9 && <0.11) [details]
LicenseBSD3
CopyrightCopyright by Michal J. Gajda '2014
AuthorMichal J. Gajda
Maintainermjgajda@gmail.com
CategoryWeb
Home pagehttps://github.com/mgajda/json-autotype
Bug trackerhttps://github.com/mgajda/json-autotype/issues
Source repositoryhead: git clone https://github.com/mgajda/json-autotype.git
Executablesjson-autotype
UploadedThu Oct 30 23:05:22 UTC 2014 by MichalGajda

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for json-autotype-0.2.1.2

json-autotype

Takes a JSON format input, and generates automatic Haskell type declarations. Goal is to also generate parser, and pretty-printer instances.

It uses union type unification. Types inferred may be automatically trimmed and unified using attribute set matching.

I should probably write a short paper to explain the methodology.

Build Status Hackage

Details on official releases will be on Hackage

USAGE:

After installing with cabal install json-autotype, you might generate stub code for the parser:

json-autotype input.json -o MyFormat.hs

Then you might test the parser by running it on an input file:

runghc MyFormat.hs input.json

If everything is correct, then feel free to inspect the data structure generated automatically for you! The goal of this program is to make it easy for users of big JSON APIs to generate entries from example data.