Added encode_json_body().
Added tests of the encode_json_body().