asp.net - How to avoid System.ArgumentException: Invalid JSON primitive: new. when parsing json in c# -
i'm parsing json using microsoft json parser:
var json = new javascriptserializer() { maxjsonlength = int.maxvalue }; return json.deserializeobject(jsonstr);
when following json server:
[{"date_of_birth": new date("thu, 17 nov 1983 00:01:00 gmt")},{"date_of_birth": new date("wed, 23 nov 1904 00:01:01 gmt")}]
it throws following exception:
system.argumentexception: invalid json primitive: new. @ system.web.script.serialization.javascriptobjectdeserializer.deserializeprimitiveobject() @ system.web.script.serialization.javascriptobjectdeserializer.deserializeinternal(int32 depth) @ system.web.script.serialization.javascriptobjectdeserializer.deserializedictionary(int32 depth) @ system.web.script.serialization.javascriptobjectdeserializer.deserializeinternal(int32 depth) @ system.web.script.serialization.javascriptobjectdeserializer.deserializelist(int32 depth) @ system.web.script.serialization.javascriptobjectdeserializer.deserializeinternal(int32 depth) @ system.web.script.serialization.javascriptobjectdeserializer.basicdeserialize(string input, int32 depthlimit, javascriptserializer serializer) @ system.web.script.serialization.javascriptserializer.deserialize(javascriptserializer serializer, string input, type type, int32 depthlimit) @ system.web.script.serialization.javascriptserializer.deserializeobject(string input)
how rid of this?
Comments
Post a Comment