Implement a JSON API

This will be consumed by the JavaScript frontend client