Lasse Hedeby

Sharing my passion for automation, programming, IT and other geeky stuff

JSON is a very powerful and simple way of arranging data and exchange it between systems.

JSON parser comes for almost every PC based programming language, but not PLC’s, so I started my own.

This parser can read and write JSON in Siemens SIMATIC S7-12xx/S7-15xx PLC’s.
There are some limitations though;

Only strings, numbers and booleans are supported.
No spaces between characters.

// Test string 
#tempJSON := '{"name":"Lasse","age":35,"sex":"male","birthDay":"1984-03-02"}'; 
// Convert string to Char array 
// Read JSON

JSON is very useful when systems has to exchange data in e.g. TCP/IP socket communication. Traditionally data exchange has to be documented and agreed on between systems, to have the same data structure for the byte stream. With JSON, this is not needed anymore, and the data and values can be arranged differently but, still understood on all systems.


April 15th, 2019

Posted In: Automation, S7-1200/1500, SIMATIC, Structured Text (SCL/ST)

Tags: , , , ,