diff --git a/Source/ULibs.TinyJsonDeser/JsonDeserializer.cs b/Source/ULibs.TinyJsonDeser/JsonDeserializer.cs index f8d92b7..66035bb 100644 --- a/Source/ULibs.TinyJsonDeser/JsonDeserializer.cs +++ b/Source/ULibs.TinyJsonDeser/JsonDeserializer.cs @@ -247,10 +247,7 @@ private static bool TryParseBool(string json, ref int offset, out bool output) switch (json[offset]) { case 't': - if (offset < json.Length - 3 && - json[offset + 1] == 'r' && - json[offset + 2] == 'u' && - json[offset + 3] == 'e') + if (offset < json.Length - 3 && json.Substring(offset, 4) == "true") { offset += 4; output = true; @@ -260,11 +257,7 @@ private static bool TryParseBool(string json, ref int offset, out bool output) break; case 'f': - if (offset < json.Length - 4 && - json[offset + 1] == 'a' && - json[offset + 2] == 'l' && - json[offset + 3] == 's' && - json[offset + 4] == 'e') + if (offset < json.Length - 4 && json.Substring(offset, 5) == "false") { offset += 5; return true; @@ -279,11 +272,7 @@ private static bool TryParseBool(string json, ref int offset, out bool output) private static bool TryParseNull(string json, ref int offset) { - if (offset < json.Length - 3 && - json[offset] == 'n' && - json[offset + 1] == 'u' && - json[offset + 2] == 'l' && - json[offset + 3] == 'l') + if (offset < json.Length - 3 && json.Substring(offset, 4) == "null") { offset += 4; return true; diff --git a/Source/ULibs.TinyJsonDeser/RELEASENOTES.md b/Source/ULibs.TinyJsonDeser/RELEASENOTES.md index 4512030..8c2c95f 100644 --- a/Source/ULibs.TinyJsonDeser/RELEASENOTES.md +++ b/Source/ULibs.TinyJsonDeser/RELEASENOTES.md @@ -1,5 +1,11 @@ # ULibs.TinyJsonDeser release notes +## 1.0.1 + +### Features + +- Improved code readability for parsing `true`, `false` and `null`. + ## 1.0.0 ### Features