void Application_Start(object sender, EventArgs e) { // Code that runs on application startup AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); Object testData = new DotnetSerializerMVC5.Models.ManyDefaultsTestData(); Object2Json = JsonConfig.DefaultObject2Json(testData); }
public DefaultJsonMapping() { json2Object = new Json2Object(); //json2Object.setToUseFields(); object2Json = new Object2Json(); object2Json.NodeExpander = new FieldReflectionNodeExpander(); object2Json.IndentSize = 2; //todo json 2 object should understand TypeAliaser object2Json.TypeAliaser = (t) => { return(t.FullName); }; object2Json.TypeAliasProperty = json2Object.TypeSpecifier; }
public DefaultJsonMapping() { json2Object = new Json2Object(); //json2Object.setToUseFields(); object2Json = new Object2Json(); object2Json.NodeExpander = new FieldReflectionNodeExpander(); object2Json.IndentSize = 2; //todo json 2 object should understand TypeAliaser object2Json.TypeAliaser = (t) => { return t.FullName; }; object2Json.TypeAliasProperty = json2Object.TypeSpecifier; }
public static Object2Json DefaultObject2Json(Object testData) { Object2Json Object2Json; // Code that runs on application startup // create global serialiser here Object2Json = new Object2Json(); Object2Json.UseReferences = true; Object2Json.NodeExpander = new FieldReflectionNodeExpander(); // add in defaults Object2Json.LeafDefaultSet = new LeafDefaultSet(); Object2Json.TypeAliaser = TypeAliaserUtils.createNumericTypeNameAliaser(); DefaultFinder df = new DefaultFinder(); //TypeAliaserUtils LeafDefaultSet lds = df.getDefaultsForAllLinkedObjects(testData, Object2Json.NodeExpander); Object2Json.LeafDefaultSet.Add(lds); return Object2Json; }