Parse JSON data from the request

Fixes #587.