JSON spec and implementation

The API should also support JSON.