Closed cdsaenz closed 5 years ago
After investigating.. I think this code will do?
if ( Assigned(JResp['json'].Items) ) then begin
You can do:
if (JResp['json'].Value <> null) then
Since the values are stored as variants.
Just added IsNull.
if (not JResp['json'].IsNull) then
Thanks! works perfect! This unit is a real timesaver.
I have this response from a REST API:
That sometimes brings an empty "json" element.. as null:
And the code that I use is something like this. Works perfect in the first case, but fails when "json" has a null value.. How can I trap that error? I tried Assigned, nil, VarIsNull, etc but always get a violation.
Must be something simple but escapes me - Thanks for your help and this great utility.