-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Null String being reported as String rather than JTokenType.Null Jame…
- Loading branch information
1 parent
828fcc3
commit 0f3b5b3
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
public class Issue2775 | ||
{ | ||
[Fact] | ||
//https://github.com/JamesNK/Newtonsoft.Json/issues/2775 | ||
public void TokenType() | ||
{ | ||
var jObject = new JObject | ||
{ | ||
{ | ||
"NullProperty", false ? "0" : null | ||
} | ||
}; | ||
|
||
var jToken = JToken.FromObject(jObject); | ||
|
||
Assert.Equal(JTokenType.Null, jToken.Children().Children().Single().Type); | ||
|
||
jObject = new() | ||
{ | ||
{ | ||
"NullProperty", (string) null | ||
} | ||
}; | ||
|
||
jToken = JToken.FromObject(jObject); | ||
Assert.Equal(JTokenType.Null, jToken.Children().Children().Single().Type); | ||
} | ||
} |