-3

how to get combined_rate value from below json data

{
    "rate": {
        "zip": "10005",
        "state": "NY",
        "state_rate": "0.04",
        "county": "NEW YORK",
        "county_rate": "0.0",
        "city": "NEW YORK CITY",
        "city_rate": "0.045",
        "combined_district_rate": "0.00375",
        "combined_rate": "0.08875"
    }
}

please help on this thanks in advance

Backs
  • 24,430
  • 5
  • 58
  • 85
  • Based on "i don't want use any class property" the http://stackoverflow.com/questions/3142495/deserialize-json-into-c-sharp-dynamic-object is better duplicate than standard http://stackoverflow.com/questions/1212344/parse-json-in-c-sharp. If you have more specific problem - please make sure to update post with code/errors/expected and observed data (see [MCVE] for guidance). – Alexei Levenkov Oct 28 '15 at 06:58

1 Answers1

0

You can define your custom class:

internal class Data
{
    public Rate rate;
}

internal class Rate
{
    public float combined_rate;
}

And deserialize this string to object:

var s = new JavaScriptSerializer();
var o = s.Deserialize<Data>(json);
var value = o.rate.combined_rate;

Also, you can extract other values from your string, just add new fields to Data class.

Backs
  • 24,430
  • 5
  • 58
  • 85