Problem Write Raw after upgrade

Sep 30, 2012 at 6:51 PM
Edited Sep 30, 2012 at 6:53 PM

Hello,

My current version of Json.NET is: 

Json .NET 3.5 Verion 4.5 

After an upgrade to this version, I did have to update several JsonConverter class instances to the new JsonConvert class, which was no biggy but, now I am having trouble with writing raw Json, the code breaks.

I get a Json.Net exception of: 

Token PropertyName in state Property would result in an invalid JSON object. Path 'results[0]'.

This code has not changed for me for several years but now with the upgrade to Version 4.5, it is broken.  My code looks something like this:

//parameters
json.WritePropertyName("parameters");
json.WriteRaw(getParameterJsonStringArray(rslts.schema[0].parameters));
//fields
json.WritePropertyName("fields");
json.WriteRaw(getFieldJsonStringArray(rslts.schema[0].fields));

In the 2nd line, I write the raw json result from my getParameterJsonStringArray method and then the code fails on the next line writing the "fields" property.

Is this a bug?

Karl..

Oct 1, 2012 at 4:50 PM

By the way, I've solved the problem using the new WriteRawValue method.

 

Karl..