JObject.Parse returns two {{ instead of one { in beginning and end

323 views Asked by At

I'm using JObject.Parse and it's not a valid json as it has two {{ in the beginning and two }} at the end instead of only one of each.

Tried catching exception but didn't hit the exception of my try catch. If I remove the extra { in the beginning and the extra } in the end jsonFormatter/validator webpage says it's okey.

  var URL = "https://api.instagram.com................my access token etc";
        HttpClient client = new HttpClient();
        client.BaseAddress = new Uri(URL);

  HttpResponseMessage response = client.GetAsync(URL).Result;

        using (HttpContent content = response.Content)
        {
            Task<string> result = content.ReadAsStringAsync();
            JObject json = JObject.Parse(result.Result);
        }

So reuslt.Result looks like this: "{\"pagination\": {}, \"data\": [{\"id\".........

and json starts looks like this: {{ "pagination": {}, "data": [ { "id": "20...............

When copying the json into formatter/validator and removing the extra { in the beginning and the extra } in the end everything is okey. So I expect the output json from JObject.Parse should look like this: { "pagination": {}, "data": [ { "id": "20...............

I can not understand why I'm getting these extra {} things?

0

There are 0 answers