Generate c# classes from json tool for Visual StudioHow to use: Tools menu->JSON to C# -> Paste your Json data -> Generate. Or Copy your json data, right-click on project folder and choose Generate classes from JSON... ExampleJSON{
"requestId": "9db9db74-de37-4d9a-a6b6-c1b2ec2bdfb0",
"metadata": {
"height": 533,
"width": 800,
"format": "Jpeg"
},
"result": {
"celebrities": [
{
"name": "Satya Nadella",
"faceRectangle": {
"width": 134,
"height": 134,
"left": 401,
"top": 103
},
"confidence": 0.9576959
}
]
}
}
Using Tool Window
Or Copy json and generate c# files direct from your clipboard
C# Results
public class RootObject
{
[JsonProperty("requestId")]
public string RequestId { get; set; }
[JsonProperty("metadata")]
public Metadata Metadata { get; set; }
[JsonProperty("result")]
public Result Result { get; set; }
}
public class Metadata
{
[JsonProperty("height")]
public int Height { get; set; }
[JsonProperty("width")]
public int Width { get; set; }
[JsonProperty("format")]
public string Format { get; set; }
}
public class Result
{
[JsonProperty("celebrities")]
public List Celebrities { get; set; }
}
public class Celebrity
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("faceRectangle")]
public FaceRectangle FaceRectangle { get; set; }
[JsonProperty("confidence")]
public double Confidence { get; set; }
}
public class FaceRectangle
{
[JsonProperty("width")]
public int Width { get; set; }
[JsonProperty("height")]
public int Height { get; set; }
[JsonProperty("left")]
public int Left { get; set; }
[JsonProperty("top")]
public int Top { get; set; }
}
|


