JavaScriptSerializer serializer = new JavaScriptSerializer();
string sJSON = serializer.Serialize(pt);
This works fine except that it also includes fields that are set as [NonSerialized]
Is there a way to exclude those fields?
I think you are looking for the ScriptIgnoreAttribute:
public class Data {
[ScriptIgnore]
public string Ignore;
public string DoNotIgnore;
}