VAR Result: String;
Result := JSONArrayItem(AJsonString : String; ItemIndex : Integer);
Demo
VAR Result : String;
VAR JSON : String;
VAR Count : Integer;
JSON := '[{"Greeting":"Hello 1 ","Name":"User 1"},{"Greeting":"Hello 2 ","Name":"User 2"}]';
Count := JSONArrayItemsCount(JSON);
ShowMessage('Count = ' + IntToStr(Count));
ShowMessage('First Element = ' + JSONArrayItem(JSON,0));
ShowMessage('Second Element = ' + JSONArrayItem(JSON,1));
//ShowMessage(JSONValue(JSON, 'Greeting'));
Exit;
VAR Result: String;
Result := JSONArrayItemCount(AJsonString : String);
Demo
VAR Result : String;
VAR JSON : String;
VAR Count : Integer;
JSON := '[{"Greeting":"Hello 1 ","Name":"User 1"},{"Greeting":"Hello 2 ","Name":"User 2"}]';
Count := JSONArrayItemsCount(JSON);
ShowMessage('Count = ' + IntToStr(Count));
Exit;
VAR Result: String;
Result := JSONItemBuild(JSONName, JSONItemName, JSONItemValue : String)
Demo
VAR Result : String;
Result := JSONItemBuild('JSONName', 'Greeting' , 'Hello 1 ');
Result := JSONItemBuild('JSONName', 'Name' , 'User');
ShowMessage(Result);
Exit;
The above code will returns :
{"Greeting":"Hello 1 ","Name":"User"}
JSONItemClear(JSONName : String);
Demo
VAR Result: String;
Result := JSONItemClear('JSONName');
Exit;
VAR Result: String;
Result := JSONValue(AJSONText : String; AValueName : String)
Demo
VAR Result : String;
VAR JSON : String;
JSON := '{"Greeting":"Hello 1 ","Name":"User"}';
ShowMessage(JSONValue(JSON, 'Greeting'));
Exit;