ASP.Net Web API - JSON without accent% 20% C3% A7

1

I'm consuming an api but the return JSON does not come with the correct accent. in place of the spice comes% 20, for example.

In the request json I even put the encoding.UFT8.

How can I code this correctly?

private string jsonRequest = @"{'action': {'name': 'get_user_drivers','parameters': [{'driver_id': '','active_drivers': '','group_id': '','version': ''}],'session_token': '" + Helpers.TraffilogLogin.GetAuthToken() + "'}";

var content = new StringContent(jsonRequest , Encoding.UTF8, "application/json");
content.Headers.Clear();
content.Headers.Add("Content-Type", "application/x-www-form-urlencoded");

HttpClient httpClientInstance = new HttpClient();
var response = httpClientInstance.PostAsync(BaseApi.traffilogApiUrl, content).Result;

JArray groupListJson = (JArray)JObject.Parse(response.Content.ReadAsStringAsync().Result)["response"]["properties"]["data"];
    
asked by anonymous 14.08.2018 / 16:23

1 answer

0

You can use the HttpUtility.UrlDecode to decode your content.

string decodedUrl = HttpUtility.UrlDecode(url); //decodedUrl é o conteúdo que você precisa decodificar.

This encoding is called Percent-encoding

    
14.08.2018 / 16:30