C
C#5mo ago
Zigy

Problem with deserializing JSON file.

Hello there I am trying to deserialize a JSON like the following: {"[982367487645900, 504339357638715104]":["id"]} Into an Dictionary<List<long>, List<string>> But newtonsoft.json (Which is what I am using for deserializing the JSON file) says that it cannot convert a string into a collection
The string here being "[76561198801345900, 504332241820975104]"
3 Replies
Jimmacle
Jimmacle5mo ago
because that key is a string, not an array pretty sure you can't use an array as a key in json
Zigy
Zigy5mo ago
Ah thank you
gerard
gerard5mo ago
If you really, really want Dictionary<List<long>, List<string>>, you can make a JsonConverter for it: https://paste.mod.gg/xpdtuesgzdjf/0 Also note that the array is in a string, so it's a string. It's hard to see without syntax highlighting:
{"[982367487645900, 504339357638715104]":["id"]}
{"[982367487645900, 504339357638715104]":["id"]}
Want results from more Discord servers?
Add your server
More Posts