delphi - error converting string to JSON with RAD Studio -
I have this problem:
I get a string with this format:
: {{"name": "j1", "type": "12"}, {"name": "j2", "type": "15"}, .....} < / code> I would like to read data such as data ("name") and read all the data values and
j1 12 j2 15 j3 23 and so on
I am using RAD Studio, FireMonkey for mobile devices.
I have written this code to parse the string JSON, read it.
Joe: TJSONJject; Jp: TJSniper; va1: TJSONvalue; va2: TJSONvalue; Which: = TJSONObject as TJSONObject.ParseJSONValue (TEncoding.ASCII.GetBytes (A), 0); Jp: = jo.Get (1); For I: = 0 begin jo.Size - 1 jp: = jo.Get (i); Memo1.Lines.Add ('ToString:' + jp.ToString); Memo1.Lines.Add ('JsonString:' + jp.JsonString.Value); If (jp.JSONValue is TJSONTrue) or (jp.JSONValue is TJSONFalse) or (jp.JSONValue is TJSONNull) then Memo1.Lines.Add ('JsonValue:' + jp.JsonValue.ToString) Other Memo1.Lines.Add (' JsonValue: '+ jp.JsonValue.Value) end; When the program executes jp: = jo.Get (1); I have this error "address 53605374 address violation 0000013C" I have tried in other ways ... but I am unable to solve the mystery.
This is not a valid Jason.
A valid Jason will be valid:
[{"name": "j1", "type": " 12 "}, {" name ":" j2 "," type ":" 15 "}, .....] or
Comments
Post a Comment