JSON encode request body according to Content-Type header