CopyJsonStringFromSymbol

CopyJsonStringFromSymbol 1:

This method generates the JSON representation of a symbol and copies it into a variable of the data type STRING, which can be of any length. The method returns the length of the string (including null termination). If the destination buffer is too small, it is emptied by a null termination and returned as length 0.

Syntax

METHOD CopyJsonStringFromSymbol : UDINT
VAR_INPUT
  nData       : UDINT;
  nDoc        : UDINT;
  pData       : PVOID;
END_VAR
VAR_IN_OUT CONSTANT
  pDoc        : STRING;
  sDatatype   : STRING;
END_VAR
VAR_OUTPUT
  hrErrorCode : HRESULT;
END_VAR

CopyJsonStringFromSymbol 2: Return value

Name

Type

CopyJsonStringFromSymbol

UDINT

CopyJsonStringFromSymbol 3: Inputs

Name

Type

nData

UDINT

nDoc

UDINT

pData

PVOID

CopyJsonStringFromSymbol 4:/CopyJsonStringFromSymbol 5: Inputs/Outputs

Name

Type

pDoc

STRING

sDatatype

STRING

CopyJsonStringFromSymbol 6: Outputs

Name

Type

hrErrorCode

HRESULT

Sample call:

nLen := fbJsonDataType.CopyJsonStringFromSymbol('ST_Test',SIZEOF(stTest),ADR(stTest),sString,SIZEOF(sString));