I received a JSON output from the response body that contains various details about a contract.
My goal is to extract only two specific pieces of information:
- "contractId"
- "contractStatus"
To achieve this, I'm utilizing JavaScript to parse and retrieve the data accurately.
{
"value" : [ {
"title" : "Test Ariba IT contract",
"description" : "",
"commodities" : [ {
"uniqueName" : "3.99",
"domain" : "custom",
"name" : "OTHER ENGINEERING SERVICES"
} ],
"regions" : [ {
"uniqueName" : "700",
"name" : "US Procurement"
} ],
"departments" : [ ],
"owner" : {
"uniqueName" : "Gautam.KumarBans",
"passwordAdapter" : "PasswordAdapter1",
"name" : "Gautam Bansal",
"emailAddress" : "Gautam.KumarBansa",
"organization" : "NaTEST",
"orgANId" : "AN01002048300-T",
"orgName" : "NatioST",
"timeZoneID" : "America/New_York",
"localeID" : "[ariba.basic.core.LocaleID [BaseId 1497 AAAAAB7XZ 15l.3f]]"
},
"contractId" : "CW1948133",
"contractStatus" : "Draft",
"supplier" : {
"name" : "[CM] KIER GROUP",
"systemID" : "50066293",
"smVendorID" : null,
"organizationIDs" : [ {
"domain" : "buyersystemid",
"value" : "50066293"
} ],
"address" : {
"name" : "50066293",
"uniqueName" : "50066293",
"phone" : "",
"fax" : "",
"city" : "",
"state" : "",
"postalCode" : ""
}
},
"effectiveDate" : "2020-12-21T00:00:00.000+0000",
...
"maximumNumberOfRenewals" : 0,
"autoRenewalInterval" : 0,
"isTestProject" : true,
...
}
Please note that the provided JSON object includes a lot of additional details beyond just the desired "contractId" and "contractStatus".