Make json_release_item more robust.

This is nice in that some C-to-C json items may use string items as
arbitrary pointers, setting them to NULL before the json item is
released in order to pass around memory ownership.