Fixed invalid conversion of input data

Fixed conversion of input data in case Content-Type header includes optional parameters like `charset` (e.g. `text/html; charset=UTF-8`. Also fixed invalid conversion of json.