Feature json api

Not ready to merge, just starting to make the first few changes towards using RestPack for JSON API support. Feel free to push this branch or make a pull request against it you're working on the same thing.