Shifted around the object types and mixins

The Api class should have really been a module. Started tests for the
JSON format.