Created
February 28, 2019 13:30
-
-
Save jskeet/0edb911cfd98ce22ae7d3b905a18b25b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Web.Script.Serialization; | |
namespace TestApp | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
string json = "{ \"expiry\":1551354842.0 }"; | |
var jsonSerializer = new JavaScriptSerializer(); | |
var data = jsonSerializer.Deserialize<Dictionary<string, object>>(json); | |
object exp; | |
data.TryGetValue("expiry", out exp); | |
Console.WriteLine(exp); | |
Console.WriteLine(exp.GetType()); | |
var tempExpiry = long.Parse(exp.ToString()); | |
Console.WriteLine(tempExpiry); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment