patched to handle serialization of undef required params.

I had a model with the following attributes and I could not freeze and thaw it without an exception.

has 'string' => ( is => 'ro', required => 1, isa => 'Str | Undef' );

To reproduce you can run the attached test: t/013_basic_json_required_undef.t

The two changes I made are:
* When expanding I only set the attributes that exist in the data hash.
* When collapsing I set the value is the "has_value" attribute is set.

It passes all tests.