Infer the structure of a JSON object and make some Perl 6 class to represent it
Latest commit 5b84ef8 Feb 4, 2017 @jonathanstowe Up version
Failed to load latest commit information.
bin Adjust script to use --kebab Feb 4, 2017
lib/JSON Up version Feb 4, 2017
t Test kebabing Feb 4, 2017
.gitignore Add rev-deps Dec 25, 2015
.travis.yml Update the .travis.yml with --notests on deps Sep 26, 2016
LICENCE rename LICENCE as en_GB May 30, 2016
META6.json Up version Feb 4, 2017 Update README Dec 5, 2016


Create Perl6 classes to represent JSON data by some dodgy inference.


Use the script to do it simply:

# Create the module in the directory "foo"

p6-json-infer --uri= --out-dir=foo --class-name=Mixcloud::Show

Or do it in your own code:

use JSON::Infer;

my $obj =
my $ret = $obj.infer(uri => '', class-name => 'Mixcloud::Show');

say $ret.make-class; # Print the class definition


JSON is nearly ubiquitous on the internet, developers love it for making APIs. However the webservices that use it for transfer of data rarely have a machine readable specification that can be turned into code so developers who want to consume these services usually have to make the client definition themselves.

This module aims to provide a way to generate Perl 6 classes that can represent the data from a JSON source. The structure and the types of the data is inferred from a single data item so the accuracy may depend on the consistency of the data.


Assuming you have a working perl6 installation you should be able to install this with panda :

# From the source directory

panda install .

# Remote installation

panda install JSON::Infer

Or with zef :

# From the source directory

zef install .

# Remote installation

zef install JSON::Infer

Other install mechanisms may be become available in the future.


Suggestions/patches are welcomed via github at


This is free software.

Please see the LICENCE file in the distribution for details.

© Jonathan Stowe 2015, 2016