Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions Source/ULibs.TinyJsonDeser/JsonDeserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions Source/ULibs.TinyJsonDeser/RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down