I have an API hosted on IIS Server.
I am making a request to a URI with below params.
{"CurrentTime":"2013-09-23 13:05:52",
"Measurement":[{"Comment":"Test Comment","RecordIdentifier":"7F54BF3C-6022-423B-8B8F-0121BA2AF516"}],
"Source":"ABC","Destination":"XYZ",
"FinalIdentifier":"058B5913-FAB9-4641-B02E-2729A02B5059"}
For the above request i can successfully deserialize the request parameters. Notice the value of "FinalIdentifier" and "Comment" parameter.
But, when Request like :
{"CurrentTime":"2013-09-23 13:05:52",
"Measurement":[{"Comment":"Âëīö","RecordIdentifier":"01CEBEAE-B99D-47B1-9C2D-1CB80069917B"}],
"Source":"ABC","Destination":"XYZ",
"FinalIdentifier":"058B5913-FAB9-4641-B02E-2729A02B5059"}
I can also deserialize this request successfully but the value of "FinalIdentifier" parameter is getting Guid.Empty (00000000-0000-0000-0000-000000000000)
.
Here notice the Umlet characters in 2nd request for comment field, it is some German characters (junk characters).
So, does junk characters affect the GUID
value ?
But, also notice the Value of "RecordIdentifier" value in both request. It is not problem with "RecordIdentifier".
So where is the thing going wrong ?
I have below Entity for Request and parsing.
public class Measurement
{
public string Comment { get; set; }
public Guid RecordIdentifier { get; set; }
}
public class MeasurentEntityMain
{
public List<Measurement> measurement { get; set; }
public Guid FinalIdentifier { get; set; }
public string Source { get; set; }
public string Destination { get; set; }
}
Above both request i have captured from fiddler. and at API side i have tested it with debugging.
So, why this Guid field set to empty field.
I am using JSON serialization and deserialization.