I am working with the new serialize and deserialize commands for JSON. I found that the deserialize command will convert a null payload to a variable with type nil:
Code: Select all
> global org [deserialize value="{\"a\":\"Hi\",\"b\":12,\"c\":null}" from=json ]
> put $org
a=Hi;b=12;c=
> put [typeof ($org->"c")]
nil
Code: Select all
> global new
> set ($new->"a") "Hi"
> set ($new->"b") 12
> set ($new->"c") #What goes here?
> put $new
a=Hi;b=12
> put [serialize $new to=json ]
{"a":"Hi","b":12}