Search code examples
c#jsonradixasp.net-web-api

base keyword in json response of an api


I have an api which returns the json as { "timestamp": 1372741243, "base": "USD" }

I would like to call this using

        HttpResponseMessage response = client.GetAsync("api/latest.json?app_id=your_api_id").Result;
        if (response.IsSuccessStatusCode)
        {
            var curr = response.Content.ReadAsAsync<Currency>().Result;
        }

Now, the base in the api cannot be parsed as I cannot have base property in the Currency class, as base is a key-word. Any suggestions to overcome this.


Solution

  • try with adding prefix "@" before the parameter name base

    public string @base { get; set; }