0

I wanted to ask how I can make a json class from the json file using dictionary. Unfortunately I do not know how the class has to look. The Copy & Paste generators do not help. And how I can use it after that is the deserialization.

Thank you in advance


{
  "Keywordmask": "Packingtable",
  "Keywords": {
    "Itemnumber": "SA4F5ASD",
    "Productname": "DA51SAD",
    "Customerorder": "44SAD",
    "Productionorder": "454DSA54-002",
    "Serialnumber": "C3H3",
    "Customernumber": "30604",
    "Customer": "Horst",
    "Endcustomer": "Magret",
    "Repair": "0",
    "Repair Itemnumber": "",
    "Comment": "",
    "Patternpicture": "1",
    "Created On": "12.04.2017 11:42:04"
  }
}
  • 1
    I don't understand where you'd want a dictionary there. It looks like it should just be a class with one string property and one property of another type. (Note that it would be easier for many readers to get context if you translated the JSON into English. It only has to be *representative* of your real data.) – Jon Skeet Apr 12 '17 at 11:20

1 Answers1

3
public class Keywordmask
{
    public string Keywordmask { get; set; }
    public Dictionary<string, string> Keywords{ get; set; }
}

Change class name to whatever is suitable

Then to convert the JSON to C# try one of the following methods

How to Convert JSON object to Custom C# object?

LiverpoolOwen
  • 806
  • 2
  • 10
  • 25