0

Starting from a VCL project to TMS WEB Core, I can no longer use "System.JSON".

Having declared :

LJsonValue: TJsonValue;
LJsonArray: TJsonArray;
LJSonString: TJsonString;

How to translate VCL line

LJsonValue := LJsonValue.GetValue<TJSonValue>('choices');
LJSonString := LJSonArray.Items[0].GetValue<TJSONString>('text');

for TMS WEB Core? I can't find the solution not being comfortable with JSON.

5
  • TMS Webcore has a WEBLib.JSON unit. Have you included this unit? Jan 30 at 13:31
  • Yes, but how to modify these two lines with GetValue?
    – L0pez
    Jan 30 at 13:38
  • Are you parsing a WebHTTPRequest response? If so, I can post and example.. Jan 30 at 14:19
  • var LCb: TTMSFNCCloudBase; LPostdata: string; LJsonValue: TJsonValue; LJsonArray: TJsonArray; LJSonString: TJsonString; if Lcb.RequestResult.Success then begin LJsonValue := TJSonObject.ParseJSONValue(Lcb.RequestResult.ResultString); LJsonValue := LJsonValue.GetValue<TJSonValue>('choices'); if LJsonValue is TJSonArray then begin LJSonArray := LJsonValue as TJSonArray; LJSonString := LJSonArray.Items[0].GetValue<TJSONString>('text'); Result := LJSonString.Value; end; end;
    – L0pez
    Jan 30 at 15:04
  • Is the response an array? Jan 30 at 16:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.