Personally, I've just extended the in-built Delphi classes into a generic class that can handle my IList needs. Here's a code sample below:
function TJsonSerialiser<T>.ObjectListFromJsonString(const AJson: string): IList<T>;
var
JsonArray: TJSONArray;
JsonItem: TJSONValue;
JsonObject: TJSONObject;//, JsonTarget: TJSONObject;
begin
JsonObject := TJSONObject.ParseJSONValue(AJson) as TJSONObject;
try
Result := TCollections.CreateObjectList<T>;
if JsonObject.TryGetValue<TJSONValue>('array', JsonArray) then
for JsonItem in JsonArray do
Result.Add(Self.ObjectFromJsonObject(JsonItem as TJSONObject));
finally
JsonObject.Free;
end;
end;
function TJsonSerialiser<T>.ObjectListToJsonString(AList: IList<T>): string;
var
JsonObject: TJSONObject;
JsonArray: TJSONArray;
Item: T;
begin
JsonObject := TJsonObject.Create;
try
JsonArray := TJSONArray.Create;
for Item in AList do
JsonArray.AddElement(TJson.ObjectToJsonObject(Item));
Result := JsonObject.ToJSON;
finally
JsonObject.Free;
end;
end;
The TJsonSerialiser is a full class handling any non-standard Json stuff such as Nullable<> types etc as well. Not sure if this helps your needs, but suits our purposes without using 3rd party libraries.