31 May 2022 06:32 PM - edited 31 May 2022 06:34 PM
Hello everyone
I try to make a script who have a json from a web site and tcheck if the key:value of the json have a différence
Exemple of json :
{
"services": [
{
"available": true,
"operation": "Communes",
"responsecode": 200,
"service": "Commune Service"
},
{
"available": true,
"operation": "Annexe Groupe",
"responsecode": 200,
"service": "Documents Service"
},
{
"available": false,
"operation": "Disponibilité",
"responsecode": 500,
"service": "Service"
},
{
"available": true,
"operation": "Verifier",
"responsecode": 200,
"service": "Plateforme"
},
{
"available": true,
"operation": "Personne",
"responsecode": 200,
"service": "Personne Service"
},
{
"available": true,
"operation": "Recherche",
"responsecode": 200,
"service": "Contrat Service"
}
]
});
My script :
var responseBody = response.getResponseBody();
var jsonData = JSON.parse(responseBody);
api.info(jsonData);
parsedJson["services"].forEach(function (singlestatus, allstatus)
if(singlestatus["operation"] === "Obtenir Communes" && singlestatus["available"] === true) {
api.fail("not good");
}
else if (singlestatus["operation"] === "Obtenir Communes" && singlestatus["available"] === true) {
api.fail("not good");
}
else if (singlestatus["operation"] === "Obtenir Communes" && singlestatus["available"] === true) {
api.fail("not good");
}
else if (singlestatus["operation"] === "Obtenir Communes" && singlestatus["available"] === true) {
api.fail("not good");
}
else if (singlestatus["operation"] === "Obtenir Communes" && singlestatus["available"] === true) {
api.fail("not good");
}
else if (singlestatus["operation"] === "Obtenir Communes" && singlestatus["available"] === true) {
}
But is failed i d'ont how i can debug it and see the output of
api.info(jsonData);
Thx for your help
01 Jun 2022 08:47 AM
Are you sure that is not EOF error in your script?
Which string number mark as error?