3

Closed

Handling empty GUIDs with JSON.NET

description

Hi,
 
when parsing objects with properties type of GUID on the CLR object and GUIDs are empty or null I get parser exceptions:
 
"{"id":"","name":"Test"}" results in "Unrecognized Guid format."
 
"{"id":null,"name":"Test"}" results in "Value cannot be null."
 
"{"id":"00000000-0000-0000-0000-000000000000","name":"Test"}" works, but I don't want to force clients to provide this.
 
It would be great if empty / null value GUIDs wouldn't throw an exception.
 
A possible solution has been posted here:
http://stackoverflow.com/questions/10063118/whats-the-correct-format-for-empty-guids-for-json-net-to-be-deserialized/10114142#10114142
Closed Apr 19, 2012 at 9:56 AM by JamesNK

comments

JamesNK wrote Apr 12, 2012 at 10:49 PM

Do the first two work with nullable Guid properties?