I have problems to read this JSON into Dicts:
{“d”:{"__metadata":{“id”:“TestUserSet(‘FIRSTNAME’)”,“uri”:“http://127.0.0.1:8080/odata/UserSet(‘FIRSTNAME’)",“type”:“ZODATA_STORE_SRV.MobileUser”},“UserId”:“FIRSTNAME”,“LoeschKZ”:false,“Uname”:“FIRSTNAME”,“EMail”:"thomas.mueller@xojo.com”}}
For example I want the “Uname” with the value FIRSTNAME.
I try it this way, but got errors I don’t understand - the JSON Parser didn’t parse everything on his own?:
DIM HTTPSocket_Daten As New HTTPSocket
DIM JSON_TestDaten As String
DIM Text_JSON_TestDaten As Text
JSON_TestDaten = "Hallo Welt!"
JSON_TestDaten = HTTPSocket_Daten.get("http://127.0.0.1:8080/odata/UserSet('FIRSTNAME')", 999)
JSON_TestDaten = DefineEncoding(JSON_TestDaten, Encodings.ASCII)
Text_JSON_TestDaten =JSON_TestDaten.ToText
TextArea_Testbereich.Text = Text_JSON_TestDaten
// MsgBox (JSON_TestDaten )
Dim jsonDict As Xojo.Core.Dictionary
jsonDict = Xojo.Data.ParseJSON(Text_JSON_TestDaten) // Mein JSON
Dim metaData As Text = jsonDict.Value("d")
Dim values() As Auto = jsonDict.Value("Uname")
For i As Integer = 0 To 2 // values.Ubound
Dim valueDict As Xojo.Core.Dictionary = values(i)
Dim name As Text = valueDict.Value("Name")
Dim description As Text = valueDict.Value("Description")
MsgBox(name + ": " + description)
Next