C#C
C#4y ago
66 replies
Owen

❔ JSON array to List KeyValuePair with Newtonsoft.JSON?

As the title reads, i'm attempting to load a config file (which successfully works) except I am struggling to figure out how I can take in my image assets as a KeyValuePair with the JSON name and value being the parameters.

Here's my JSON code snippet:
{
  "image_asset_urls": [

    {
      "bot_icon":"test.com/test.png"
    }
    
  ]
}


Here's my C# translation using Newtonsoft.Json:
        [JsonProperty("image_asset_urls")]
        public List<KeyValuePair<string, string>>? Images { get; set; }


How would I correctly do this?
Thanks.
Was this page helpful?