0

I'm trying to find a solution to parse a random JSON to Excel. I tried using JSON.NET but it seams that I always need to know the field names. But I will not know them. And the data count can also vary. For example:

{
   "0":{
      "Index":"A1",
      "ABC-05":3.0,
      "XY-06":3.0
   },
   "1":{
      "Index":"A4",
      "ABC-05":1.0,
      "XY-06":1.0
   }
}

But I could also have:

{
   "0":{
      "Index":"A1",
      "ZX-07":3.0,
   },
   "1":{
      "Index":"A4",
      "ZX-07":1.0,
   }
}

The index field will always be there.

Can you please give me some advice?

Yenne
  • 1
  • You don't need to know the field names at all. You could work with the data as `JToken`, `JObject`, and `JArray`. – ProgrammingLlama May 24 '22 at 06:53
  • Those json files don't look "random" to me. So, how do you define "random" in this context? – Fildor May 24 '22 at 07:09
  • like I said, the field count can vary, the field names will vary and the index values can also vary but mostly they shoudn't . So I can not just parse field "ABC-05", field "XY-06" and so on, because field "ABC-05" will never be called "ABC-05" again in future json files. – Yenne May 24 '22 at 07:23
  • Dictionary of Dictionaries then? – Caius Jard May 24 '22 at 09:37

0 Answers0