i trying iterate on following json in c# , push values list, wondering how syntax of be. getting parsing jsons, wondering how done. here json answer purposes:
var retval = { "2016": 4000000, "2017": 400000, "2018": 8324, "2019": 4000000, "2020": 4000000, "2021": 400000, "2022": 8324, "2023": 4000000, "2024": 4000000, "2025": 400000, "2026": 8324, "2027": 4000000, "2028": 4000000, "2029": 400000, "2030": 8324, "2031": 4000000, "2032": 4000000, "2033": 400000, "2034": 8324, "2035": 4000000, "2036": 4000000, "2037": 400000, "2038": 8324, "2039": 4000000, "2040": 4000000, "2041": 400000, "2042": 8324, "2043": 4000000, "2044": 4000000, "2045": 400000, "2046": 8324, "2047": 4000000, "2048": 4000000, "2049": 400000, "2050": 8324, "2051": 4000000, "2052": 4000000, "2053": 400000, "2054": 8324, "2055": 4000000, "2056": 4000000, "2057": 400000, "2058": 8324, "2059": 4000000, "2060": 4000000, "2061": 400000, "2062": 8324, "2063": 4000000, "2064": 4000000, "2065": 400000, "2066": 8324, "2067": 4000000, "2068": 4000000, "2069": 400000, "2070": 8324, "2071": 4000000, "2072": 4000000, "2073": 400000, "2074": 8324, "2075": 4000000, "2076": 4000000, "2077": 400000, "2078": 8324, "2079": 4000000, "2080": 4000000, "2081": 400000, "2082": 8324, "2083": 4000000, "2084": 4000000, "2085": 400000, "2086": 8324, "2087": 4000000, "2088": 4000000, "2089": 400000, "2090": 8324, "2091": 4000000, "2092": 4000000, "2093": 400000, "2094": 8324, "2095": 4000000, };
first off, posted isn't json. need escape out "'s
"{ \"2016\": 4000000, \"2017\": 400000, ...
the json posted single object, not list, since these name/value pairs can deserialize
dictionary<string, int> values = jsonconvert.deserializeobject<dictionary<string, int>>(json);
once have in dictionary can want it.
Comments
Post a Comment