When generating JSON from Postgres, you may end up with an array or object being ‘null’ instead of [] or {}. I think as null could be considered an acceptable [] or {}, the GetArrayItemByName/GetObjectItemByName with create = true should support the value being null
//Change for both GetObjectItemByName and GetArrayItemByName
function TROJSONObject.GetArrayItemByName(const AName: JSON_String;
ACreate: Boolean): TROJSONArray;
var
aItem : TROJSONProperty;
begin
Result := nil;
aItem := FindItem(AName);
if assigned( aItem ) then
begin
if (aItem.ValueType = jdtNull) then aItem := nil;
end;