mirror of
https://github.com/vishapoberon/vipak.git
synced 2026-04-05 20:42:26 +00:00
28 lines
741 B
Modula-2
28 lines
741 B
Modula-2
MODULE testJsonParser;
|
|
IMPORT vpkJsonParser, Out;
|
|
|
|
VAR
|
|
jsonRecord: vpkJsonParser.JsonTypePointer;
|
|
testValue: ARRAY 128 OF CHAR;
|
|
keyFound: BOOLEAN;
|
|
|
|
BEGIN
|
|
jsonRecord := vpkJsonParser.Create("{'foo': 'bar', 'test': 'test1', 'test2': {'sub': 'dub'}}");
|
|
|
|
keyFound := jsonRecord.GetTerminal(jsonRecord, "foo", testValue);
|
|
|
|
IF keyFound THEN
|
|
Out.String('found KEY');
|
|
Out.String(testValue); Out.Ln;
|
|
ELSE
|
|
Out.String('Value for the Key is not found'); Out.Ln;
|
|
END;
|
|
keyFound := jsonRecord.GetTerminal(jsonRecord, "test2.sub", testValue);
|
|
IF keyFound THEN
|
|
Out.String('found KEY');
|
|
Out.String(testValue); Out.Ln;
|
|
ELSE
|
|
Out.String('Value for the Key is not found'); Out.Ln;
|
|
END;
|
|
|
|
END testJsonParser.
|