I am using web api and I need to saving json objects to my database. I will get the screen size, color, ... and save to database.
{ "height": 1536, "width": 2048, "color": "#114521" }
But I do not want to create C# class for this data. I want to create a class named settings:
public class Settings{
public string Username {get;set;}
public string Data {get;set;} // This will be json settings data
}
But I will get back this as json object.
I am creating a new settings C# instance:
public Settings Get(){
var settings = new Settings{
Username="myname",
Data="{ \"height\": 1536, \"width\": 2048, \"color\": \"#114521\" }"
};
return settings;
}
But Data
is going to client as text, not json object.
(I will save Data
to database as raw json.)