SetSymbolFromJson

SetSymbolFromJson 1:

This method extracts a string containing a valid JSON message and attempts to save the contents of the JSON object to an equivalent data structure. The method receives as its input parameters the string with the JSON object, the data type name of the target structure, and the address and size of the target structure instance.

Syntax

METHOD SetSymbolFromJson : BOOL
VAR_IN_OUT CONSTANT
  sJson       : STRING;
  sDatatype   : STRING;
END_VAR
VAR_INPUT
  nData       : UDINT;
  pData       : PVOID;
END_VAR
VAR_OUTPUT
  hrErrorCode : HRESULT;
END_VAR

SetSymbolFromJson 2: Return value

Name

Type

SetSymbolFromJson

BOOL

SetSymbolFromJson 3: Inputs

Name

Type

nData

UDINT

pData

PVOID

SetSymbolFromJson 4:/SetSymbolFromJson 5: Inputs/Outputs

Name

Type

sJson

STRING

sDatatype

STRING

SetSymbolFromJson 6: Outputs

Name

Type

hrErrorCode

HRESULT

Sample call:

fbJsonDataType.SetSymbolFromJson(sJson,'ST_Values',SIZEOF(stValuesReceive), ADR(stValuesReceive));