Resolution for JSON parsing error “The given key was not present in the dictionary.”

Server Man

Well-Known Member
May 17, 2015
Windows 10
Windows 10
Chrome 72.0.3626.121
Chrome 72.0.3626.121
Thread starter #1
While leveraging SCOM REST API, if you get the error message “The given key was not present in the dictionary.“ then it means that the request body is not being parsed correctly. For resolving this error, make sure that the Content-Type header is set to “application/json” and JSON.stringify() is called on the data value to convert it into string.

Below is a sample snippet of the script with the usage of Content-Type header and JSON.stringify to resolve such errors:

window.onload = function () {
url: "/OperationsManager/data/performance",
type: "POST",
headers: {
"Content-Type": "application/json"
data: JSON.stringify({
"objectname":"Health Service",
"countername":"agent processor utilization",

Continue reading...