Specify prefix for property name?

Nov 12, 2011 at 1:54 AM

Hi,

I'm trying to create a json object which looks like this:

{
	"AddingPaddock.FarmId":"1013",
	"AddingPaddock.FarmName":"Home farm",
	"AddingPaddock.Name":"123",
	"AddingPaddock.Area":"12.00"
}

By serializing a c# object which looks like this:

public class AddPaddockModel
{
	public int FarmId { get; set; }
	public string FarmName { get; set; }
	public string Name { get; set; }
	public decimal ?Area { get; set; }
}
As you can see, each property name on the json object has a prefix of "AddingPaddock." 
Can I do this with json.net? I had hoped to find an extension point where I could add the prefix.
I've had a look through the source, and I don't think I can accomplish this with a custom converter, because they handle the "value" side of the name/value pair.
I could subclass JsonTextWriter (which actually writes out the property name), but I wouldn't know how to use my subclass.
Thanks,
Darren.