I'd like to save s JSON file as a field in a SQL database, for debugging purposes. What field type should I use? I am deserializing the JSON fine and saving the fields OK, but I'd like to save the original JSON file too.
public class WixOrder
{
[Key]
public Guid OrderId { get; set; }
public string Json { get; set; }
[MaxLength(50)]
public string OrderNumber { get; set; }
[MaxLength(50)]
public string RestaurantId { get; set; }
[MaxLength(50)]
public string Locale { get; set; }
[MaxLength(50)]
public string OrderDate { get; set; }
[MaxLength(4000)]
public string Comment { get; set; }
public int ? Price { get; set; }
[MaxLength(50)]
public string Currency { get; set; }
public List<WixOrderItem> OrderItems { get; set; }
public WixDelivery Delivery { get; set; }
public WixContact Contact { get; set; }
public WixAddress Address { get; set; }
public WixPayment Payment { get; set; }
public long ? Created { get; set; }
public long ? Modified { get; set; }
public int ? ItemsCount { get; set; }
[MaxLength(10)]
public string TotalPrice { get; set; }
public int SaveCount { get; set; }
public long OrderProcessMilliseconds { get; set; }
public long OrderSaveMilliseconds { get; set; }
public DateTime ? DateReceived { get; set; }
public DateTime ? DateLastPrinted { get; set; }
}
The public string Json { get; set; } is an nvarchar(MAX) field but it blank if the JSON file is over 8000 characters. The files I'd like to store are sometimes over 400KB.