Is there an easy way to convert Json string to C# object?
I have a swagger file in json format and need to make it to C# object
{
"swagger": "2.0",
"info": {
"version": "Profiles",
"title": "Profiles"
},
"paths": {
"/api/Profiles/Get": {
"get": {
"tags": [ "Profiles"],
"operationId": "Profiles_GetById",
"consumes": [],
"produces": [],
"parameters": [{ "name": "id"}]
}
},
"/api/Profiles": {
"get": {
"tags": [
"Profiles"
],
"operationId": "Profiles_GetBySubscriptionid",
"consumes": [],
"produces": [],
"parameters": [{ "name": "subscriptionId"}]
}
}
},
"definitions": {}
}
So the problem that I am facing right now is that I have no idea how to convert paths to properties of my C# object. Specifically, I have no clue how I define a C# object properties for "/api/Profiles/Get", or "/api/Profiles".
public class SwaggerObject
{
[JsonProperty("paths")]
public SwaggerPath Paths { get; set;}
}
public class SwaggerPath {
...
}