I have this array:
["a", "b", "c", "d"]
I need to get these results out using XSuperObject. Currently, from my understanding of the XSuperObject library, you would need something like this to get the data out:
aObj := SA(returnString);
for i := 0 to aObj.Length - 1 do
begin
obj2 := aObj.O[i];
arrayElement := GetJsonValue(obj2, keyValue);
end;
GetJSONValue is a function defined as:
function TfrmMain.GetJsonValue(obj:ISuperObject; Name: String): String;
begin
Result := '';
if obj.Contains(Name) then
Result := obj.S[Name];
end;
This work for an array that is returned in this JSON format:
[{"activityID":"1","keyValue":"a"},
{"activityID":"2","keyValue":"b"},
{"activityID":"3","keyValue":"c"}]
How would I get the XSuperObject library to work for the array at the top.
Any help would be greatly appreciated.
Thanks in advance.
You have an array of strings, not an array of objects, so skip
GetJsonValue()
and useaObj.S[i]
by itself: