Last active
January 4, 2016 09:09
-
-
Save brunomlopes/8600424 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
| internal class A | |
| { | |
| public string uid { get; set; } | |
| } | |
| public static class Class1 | |
| { | |
| public static void Run() | |
| { | |
| var regexp = new Regex(@"'uid':\s*(?<uid>[0-9]{8}[0-9]+)\s*", RegexOptions.Multiline); | |
| var value = @" | |
| { | |
| 'uid': 200532601548057346057920392776 }"; | |
| value = regexp.Replace(value, "'uid':'$1'"); | |
| var a = JsonConvert.DeserializeObject<A>(value); | |
| Debug.Assert(a.uid == "200532601548057346057920392776"); | |
| value = @" | |
| { | |
| 'uid': 200532 }"; | |
| value = regexp.Replace(value, "'uid':'$1'"); | |
| a = JsonConvert.DeserializeObject<A>(value); | |
| Debug.Assert(a.uid == "200532"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment