Dim content As New Dictionary(Of String, Dictionary(Of String, IEnumerable(Of String))) content.Add("list", New Dictionary(Of String, IEnumerable(Of String)) From { {"grouplist", {"fruit", "animal", "flower"}}, {"fruit", {"リンゴ", "バナナ", "イチゴ"}}, {"animal", {"イヌ", "ネコ", "ウサギ"}}, {"flower", {"バラ", "ユリ", "キク"}} }) content.Add("list2", New Dictionary(Of String, IEnumerable(Of String)) From { {"grouplist", {"fruit", "animal", "flower"}}, {"fruit", {"リンゴ", "バナナ", "イチゴ"}}, {"animal", {"イヌ", "ネコ", "ウサギ"}}, {"flower", {"バラ", "ユリ", "キク"}} }) 'list に要素を追加 content("list")("grouplist") = content("list")("grouplist").Append("planet") content("list").Add("planet", {"Earth", "Mars", "Jupiter"}) Dim jsonText As String = JsonConvert.SerializeObject(content, Formatting.Indented) Debug.WriteLine(jsonText)
Dim content As New Dictionary(Of String, Dictionary(Of String, IEnumerable(Of String))) Dim manifest = New Dictionary(Of String, IEnumerable(Of String)) From { {"grouplist", {"fruit", "animal", "flower"}}, {"fruit", {"リンゴ", "バナナ", "イチゴ"}}, {"animal", {"イヌ", "ネコ", "ウサギ"}}, {"flower", {"バラ", "ユリ", "キク"}}} content.Add("list", manifest) content.Add("list2", manifest) manifest("grouplist") = manifest("grouplist").Append("planet") manifest.Add("planet", {"Earth", "Mars", "Jupiter"}) Dim jsonText As String = JsonConvert.SerializeObject(content, Formatting.Indented) Debug.WriteLine(jsonText)