misc fixes, and new json schema

Initial json schema. For now only the first example in the specification works.
As above: a brief explanation of what this is for would be great.