Closed AdriaanBoshoff closed 6 years ago
No worries. But this looks just like the data you posted in the previous issue?
Since Message
contains a json encoded string you'll have to parse it after parsing the general text.
procedure test;
var
data, users, user: TJSON;
begin
data := TJSON.Parse({JSON TEXT});
try
users := TJSON.Parse(data['Message'].AsString);
try
for user in users do
begin
showmessage(user['SteamID'].AsString);
end;
finally
users.free;
end;
finally
data.free;
end;
end;
It is the same data. I just wanted to see how you would parse it because I still keep getting a crash no matter what application I try to parse it with. Thanks for the response.
I think I know what my issue is. As soon as procedure TForm1.websocketclient1DataIn(Sender: TObject; DataFormat: Integer; Text: string; EOM: Boolean);
fires it is still busy receiving data and the parser is trying to parse only have of the data it received and as it's not a valid json then it crashes.
So to test this i removed parsing of data and only let it show on the memo. As the screenshot shows it shows that data in the first second but then adds the rest 3 seconds after. I think I can get around this by putting this in a new thread.
It seems that I was correct. The top memo shows data from the server thats not running in a thread but the bottom memo shows data that it got from the server while running in a thread. Thus it could be parsed as it got all the data.
Ah, that makes sense.
Sorry I must be annoying with all my questions. What is the best way I can parse this? It's raw data straight from my server. I want to get the Display Names in a combobox