RhodesB4A Member Licensed User Longtime User Oct 30, 2013 #1 Im trying to parse this simple JSON object but I'm failing. [{"value": "New", "onclick": "CreateNewDoc()"}] How do I take care of the [] because .NextArray and .NextObject do not seem to work. Thanks in advance.
Im trying to parse this simple JSON object but I'm failing. [{"value": "New", "onclick": "CreateNewDoc()"}] How do I take care of the [] because .NextArray and .NextObject do not seem to work. Thanks in advance.
NJDude Expert Licensed User Longtime User Oct 30, 2013 #2 You can use .Replace("[", "").Replace("]", "") off the JSON text. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Oct 31, 2013 #3 Works fine: Code: Copy Sub Activity_Create(FirstTime As Boolean) Dim j As JSONParser j.Initialize("[{""value"": ""New"", ""onclick"": ""CreateNewDoc()""}]") Dim m As Map = j.NextArray.Get(0) 'get the first element in the list Log(m) End Sub Upvote 0
Works fine: Code: Copy Sub Activity_Create(FirstTime As Boolean) Dim j As JSONParser j.Initialize("[{""value"": ""New"", ""onclick"": ""CreateNewDoc()""}]") Dim m As Map = j.NextArray.Get(0) 'get the first element in the list Log(m) End Sub