I am trying to access all the values of OperationId in the below json and add it to an array, but it keep giving me a null exception as I drill down the data. Below is the json, any suggestion on how I can access operationIds directly are appreciated.
A Note: All the controller Names & HttpVerbs are variable throughout the json, this is just a small part from a 10,000 line Json file, so hardcoding each value to get a string doesn't work.
Json:
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "API Services"
},
"host": "TestApi.Com",
"basePath": "/TestApi",
"schemes": ["https"],
"paths": {
"/activity/actions": {
"get": {
"tags": ["activities"],
"summary": "Returns a list of non-hidden Actions.",
"description": "Test Description",
***"operationId": "GET/activity/actions", //Need to add this to array***
"consumes": [],
"produces": ["application/json", "text/json", "application/xml", "text/xml"],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ActionResponse"
}
}
}
}
},
"put": {
"tags": ["activities"],
"summary": "Updates any/all existing ActivityActions by matching Id",
"description": "Test Description",
***"operationId": "PUT/activity/actions", //Need to add this to array***
"consumes": ["application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"],
"produces": ["application/json", "text/json", "application/xml", "text/xml"],
"parameters": [{
"name": "List`1",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ActivityActionPutRequest"
}
}
}, {
"name": "Authorization",
"in": "header",
"description": "AccessToken",
"required": false,
"type": "string"
}],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ActivityActionUpdateResponse"
}
}
}
}
}
},
"/activity/agency-url/create": {
"get": {
"tags": ["activities"],
"summary": "Test",
***"operationId": "GET/activity/agency-url/create", //Need to add this to array***
"consumes": [],
"produces": ["application/json", "text/json", "application/xml", "text/xml"],
"parameters": [{
"name": "EntityType",
"in": "query",
"description": "Test",
"required": true,
"type": "string"
}, {
"name": "EntityId",
"in": "query",
"description": "The Guid or Sequence No of the entity.",
"required": true,
"type": "string"
}, {
"name": "Authorization",
"in": "header",
"description": "AccessToken",
"required": false,
"type": "string"
}],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ActivityUrlResponse"
}
}
}
}
}
}
}
So Output will look like:
[GET/activity/actions, PUT/activity/actions, GET/activity/agency-url/create]