Added support for JSON strings instead of an array of POST parameters

Fixes #1521