PCT-740, PCT-670: add support for FORMAT=JSON

Tests pass: http://tools-ci.percona.com/job/percona-agent-branch/55/