using System;
using System.Collections.Generic;
using System.Text.Json;
class Program
{
const string _text = @
"{""One"":1,""Two"":2}";
static void Main()
{
var result = JsonSerializer.Deserialize<Dictionary<string, int>>(_text);
// Loop over dictionary from JSON.
foreach (var item in result)
{
Console.WriteLine(
"ITEM: {0}, {1}", item.Key, item.Value);
}
}
}
ITEM: One, 1
ITEM: Two, 2