View Single Post
 
Old 03-14-2017, 10:09 PM
Zaaka Zaaka is offline
Senior Member
 
Join Date: Aug 2002
Location: Teesside, UK
Posts: 212
Default

Its OK now I have sorted it, for anybody who is curious heres the code

sResponse is the Response from the idHTTP Get which is my original JSON string in original question.

Code:
var
  jsonObjectLevel1: TJSONObject;
BEGIN
jsonObjectLevel1 := TJSONObject.ParseJSONValue
    (TEncoding.UTF8.GetBytes(sResponse), 0) as TJSONObject;
  try
    frmMainForm.memTVDBAuthToken.Text := jsonObjectLevel1.GetValue
      ('token').Value;
    frmMainForm.memTVDBAuthToken.Lines.SaveToFile
      (cf(ExtractFilePath(ParamStr(0))) + 'TVDBToken.text');
  finally
    jsonObjectLevel1.Free;
  end;