unittests for Jsonbody and minor fix

if anyone has any idea how to implement code coverage for the last bit that would be great. The assigment the `$errorMsg` differs on php version due to `function_exists('json_last_error_msg')`