jsonWriteVariable

This function block writes a JSON object to PLC variables.

Function Block Interface

I/O Parameter Description Data type Default Value
IN pJSONObject Address of the JSON object to write to PLC variables UDINT (STRING*)
IN MaxJSONObjectLength Size of memory to allocate for internal data buffers UDINT 100000
IN MaxIterations Maximum number of iterations to perform while processing UDINT 10000
OUT Status Function block status. 0 = Successful write. UINT

Protocol

JSONObject: {
    "globalVar": 52,
    "myTask:localVar": {
      "elem1": "Hi!",
      "elem2": 654.321
    }
}

Valid Characters

OMJSON writes only characters 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, and 0x20-0x7F.

OMJSON handles unrecognized characters in text inputs by ignoring them.
Certain ASCII control, ASCII extended, and wide characters will not be written to the plc.

If a string contains both valid and invalid characters, valid characters are still written.