Parse JSON data from the request

Fixes #587.
Seems good enough for now.