问题
I'm trying to add a new property to an existing object from a json file. I would like to add a new profile being stored in a json file
Here is the json structure of the file.

You see, I need to go after: "profiles": { and add the stuff here, duplicate one of those profiles structure and paste it here with new data. ex. "NEW PROFILE NAME": {"name": "NEW PROFILE NAME", "lastVersionId": "VERSION ID"
Here is what I have so far, but don't know what to do with it, maybe you will understand
Imports System.IO
Imports Newtonsoft
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Module Module1
Sub Main()
Dim reader As New StreamReader("C:\Launcher_Profiles.json")
Dim jsonData As String = reader.ReadToEnd
reader.Close()
'At this point we have the json data in a string variable, parse it and enumerate
'each token in the parent "objects" and if it starts with realms we will add a new
'MinecraftData object to a list of MinecraftData objects
Dim allData As JObject = JObject.Parse(jsonData)
Dim minecraftDataList As New List(Of ProfileData)
For Each token As JToken In allData("objects")
Dim prop As JProperty = token
If prop.Name.StartsWith("profiles") Then
minecraftDataList.Add(New ProfileData With {.ProfileName = prop.Name, .ProfileVersion = prop.Value("ProfileVersion"), .Size = prop.Value("size")})
End If
Next
'Now you have all of the data in the minecraftDataList
For Each md As ProfileData In minecraftDataList
Console.WriteLine(md.ProfileName)
Console.WriteLine(md.ProfileVersion)
Console.WriteLine(md.Size)
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
来源:https://stackoverflow.com/questions/30690288/adding-new-property-to-json-object-using-vb-net