.net - JSON.NET date with space in timezone offset -
i have odd issue vb.net program (vs2012 / .net framework 4) uses json.net (newtonsoft) v4.0.8 serialise objects. there dates amongst properties of class i'm serialising, , date serialised include timezone offset of +0000 or +0100 expect. however, on customer's computer plus being serialised space, , on being deserialised later (having been in database, in same vb.net program using same json.net dll), deserialise method throws exception saying string isn't in correct format (and can see it's when it's trying parse number @ heart of json.net dll).
an example of date see on computer , on customers' computers is:
"/date(1455017231091+0000)/"
whereas 1 customer (and possibly others, judging number of times i've seen resultant exception) comes out this:
"/date(1455017231091 0000)/"
i'm not sure how can reliably deal (probably regex looks appropriate number of digits followed space , 4 digits) first of want find out if normal , whether can stop happening using setting on date serialiser.
note since has been in production know json.net has switched default iso8601 date format, considering using, need convert existing dates stored in database first.
the code using serialise looks this:
stringstoredindatabase = jsonconvert.serializeobject(instanceoft)
and code deserialise looks this:
jsonconvert.deserializeobject(of t)(stringstoredindatabase)
any advice appreciated.
Comments
Post a Comment