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

Specify prefix for property name?

Nov 12, 2011 at 2:54 AM


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

	"AddingPaddock.FarmName":"Home farm",

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 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.