Handle JSON payloads

Closes gh-4