Search code examples
c#jsondeserialization

What C# data type would you de-serialize this Json into


What kind of C# data type / List / Class would I de-serialise the following json into when the 3-character codes (ara, ces, cym, dei etc) are dynamic.

Thanks!

"translations":{
"ara":{"official":"مملكة هولندا","common":"هولندا"},
"ces":{"official":"Nizozemské království","common":"Nizozemsko"},
"cym":{"official":"Kingdom of the Netherlands","common":"Netherlands"},
"deu":{"official":"Niederlande","common":"Niederlande"},
"est":{"official":"Madalmaade Kuningriik","common":"Holland"}
}"

When I say dynamic - at run time you don't know what they are or how many you will be returned.


Solution

  • You can deserialise this json into

    a class which has a property T(t)ranslations

    and this property is a Dictionary<string, SomeClass>.