Q: JavaScriptSerializer.Deserialize Gives Null Fields I sent the following JSON to a WCF service which accepts Stream as a parameter. 
{"ReservationStream":
{"clientFirstName":"Abe",
"clientLastName":"Lincoln",
"clientPhone":"0544944860",
"clientEmail":"abe@mail.com",
"pickupLocationID":"3699",
"pickupAddressString":"JFK Airport Terminal 1",
"pickupFlightNumber":"LY001",
"pickupAirline":"El Al",
"pickupAirportName":"John F Kennedy Intl",
}
}

In the debugger, the stream variable shows all values as expected. I want to deserialize into a class defined as follows:
public class ReservationStream
{
        public String clientFirstName { get; set; }
        public String clientLastName { get; set; }
        public String clientPhone { get; set; }
        public String clientEmail { get; set; }
        public String pickupLocationID { get; set; }
        public String pickupAddressString { get; set; }
        public String pickupFlightNumber { get; set; }
        public String pickupAirline { get; set; }
        public String pickupAirportName { get; set; }
}

When I call 
 JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            ReservationStream structuredReservations = javaScriptSerializer.Deserialize<ReservationStream>(strJSON);

no exception is thrown, but all of the fields have null values. Where is my mistake?

A: I think it's because your JSON object is nested inside a ReservationStream tag.
Try with just:
{
    "clientFirstName":"Abe",
    "clientLastName":"Lincoln",
    "clientPhone":"0544944860",
    "clientEmail":"abe@mail.com",
    "pickupLocationID":"3699",
    "pickupAddressString":"JFK Airport Terminal 1",
    "pickupFlightNumber":"LY001",
    "pickupAirline":"El Al",
    "pickupAirportName":"John F Kennedy Intl"
}

A: You're trying to deserialize an object containing a ReservationStream object rather than the ReservationStream object itself.
One way to get around this is to make a wrapper class which contains a ReservationStream and deserialize using this:
public class WrapperClass
{
    public ReservationStream ReservationStream { get; set; }
}

WrapperClass wrapperClass = serializer.Deserialize<WrapperClass>(strJSON);


A: I once have the same problem and I removed the javaScriptSerializer and directly used the method parameter like this
public static string UpdateTemplateProperties(TemplateProperties templateProperties)
{
    var x = templateProperties.Something
}

and I have the javascript object structure as you
just be sure to have the same name for the parameter and the first object-name in your javascript object literal
