Bug fixes for uROJSONParser

json

(hsvandrew) #1

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;

(EvgenyK) #2

Hi,

can you create a simple testcase that illustrates this Postgres behavior, pls?
you can attach it here or send directly to support@