This project has moved and is read-only. For the latest updates, please go here.

Problem when deserializing null values to properties of type JObject

Jun 3, 2014 at 10:24 AM

With the latest version of the Newtonsoft.Json library(v I get an error when deserializing a null value to a property of type JObject.

Here is a sample code that fails(just overwrite Program.cs in a new Console Application project):
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ConsoleApplication1 {
    class Program {
        static void Main(string[] args) {
            var js = new JsonSerializer();
            var tt = JsonConvert.DeserializeObject(
                "{ \"Value\": null }",

    public class TestClass {
        public JObject Value {
The error is:
Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JObject'.

The same code worked with a previous version. I think it should work. Can you please advise?

Oct 15, 2014 at 10:09 AM

I met the exact same problem. I am using version 6.0.5.

Could anybody shed some light on this?