When you need to get a type from say JSON to C# and it's not a simple primitive atomic type (float, int, bool, or char) you will need to get creative. Maybe a JSON object will be demanded for the fish that has evolved to walk on land, but there are a lot of the smidge-better-than-amoeba mollusks in the "sea" that are capable of just being cast from strings, and the decimal type is an example ...so you could hand in a string to make a decimal. DateTime types are often communicated in string format, especially so when talking into SQL. ISO 8601 is an example of a spec for strings for DateTime stuff.
Addendum 5/9/2018: 2012-04-23T18:25:43.511Z is suggested as a good JSON format for holding a JavaScript date here.
No comments:
Post a Comment