Ok. Now this sounds like a string handling problem.
I expect that the function you are using is just copying the received characters, but not the end of string character. That's pretty common for many CoDeSys features. While a string needs a end of string (Ascii code =0) character after the last letter, you have to put this manually after the last letter. The easiest way is to use sysMemSet() from library SysMem. If you do not set this character, the string continues until the next random position of char(0).
VAR
strJson: STRING(1000); // sizeOf(strJson) = 1000+1
END_VAR
// fill the complete string with Char(0)=End of string char
SysMemSet(pDest:=ADR(strJson), udiValue:=0, udiCount:=SIZEOF(strJson));
// insert here your code which copies the data into strJson
// e.g. receive JSON string
... View more