1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | METHOD Value VAR valueloop: UDINT; lookforname: BOOL; j: UDINT; found a ":" character, possible next characters are any combination of the following: { begin another object [ begin a new array " or a number or letter: value found loop through until a value is found, incrementing obj_level or array definitions as necessary bufferposition:= bufferposition + 1; //start searching after the ":" character FOR valueloop:= 1 TO 20 DO //a new object or array was found, and all nested objects have already been looped through, therefore this buffer position must start a new name FOR j:= value_start TO (value_start+GPL_JSON.MAX_VALUE_SIZE) DO IF (JSONString^[j] = ASCII.DOUBLE_QUOTE) THEN //end of value is is found at the closing quote value_stop:= j - 1; ELSIF (JSONString^[j] = ASCII.COMMA) OR (JSONString^[j] = ASCII.CLOSE_BRACE) OR (JSONString^[j] = ASCII.CLOSE_BRACKET) THEN //end of value is is found at , or }, or ] findname:= TRUE; //there is a name:value pair in the NameValue array, check for a match with a local variable EXIT; END_CASE END_FOR |