diff --git a/Src/Newtonsoft.Json.Tests/Issues/Issue2775.cs b/Src/Newtonsoft.Json.Tests/Issues/Issue2775.cs
new file mode 100644
index 000000000..5ce1bf134
--- /dev/null
+++ b/Src/Newtonsoft.Json.Tests/Issues/Issue2775.cs
@@ -0,0 +1,32 @@
+using System.Linq;
+using Newtonsoft.Json.Linq;
+#if DNXCORE50
+using Xunit;
+using Test = Xunit.FactAttribute;
+using Assert = Newtonsoft.Json.Tests.XUnitAssert;
+using TestCase = Xunit.InlineDataAttribute;
+#else
+using NUnit.Framework;
+#endif
+
+namespace Newtonsoft.Json.Tests.Issues
+{
+ public class Issue2775
+ {
+ [Test]
+ //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.AreEqual(JTokenType.Null, jToken.Children().Children().Single().Type);
+
+ jObject = new JObject { { "NullProperty", (string)null } };
+
+ jToken = JToken.FromObject(jObject);
+ Assert.AreEqual(JTokenType.Null, jToken.Children().Children().Single().Type);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs
index 618063e24..7092e1b7a 100644
--- a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs
+++ b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs
@@ -281,6 +281,12 @@ public override void WriteComment(string? text)
/// The value to write.
public override void WriteValue(string? value)
{
+ if (value == null)
+ {
+ WriteNull();
+ return;
+ }
+
base.WriteValue(value);
AddJValue(new JValue(value), JsonToken.String);
}