Not able to parse the JSON

hydu95358
Tera Contributor

 

Hi All

 

I have a requirement to update the asset using the serial number(Unique in both systems) (this is stored in ServiceNow cmdb table) from below JSON and get the leaseStartDate and plannedLeaseEndDate

 

Scheduled JOB

 

var response = r.execute();
     var responseBody = response.getBody();
     var httpStatus = response.getStatusCode();
     var parseq = JSON.parse(responseBody);
 
 

I did try to run the code from the schedule job but not able to parse the data

 

{"data":[{"customerContext":{"customerName":"CORPORATION","leaseCompanyName":"C Limited","customerNumber":8233247,"leaseCompany":41},"assetId":410280310,"description":"Tablet PC Surface Pro 9 13,0","class":"TBL","category":"hardware","leaseScheduleId":6014522,"leaseStartDate":"2024-01-01","plannedLeaseEndDate":"2026-12-31","minimumLeaseTermEndDate":"2026-12-31","serialNumber":"0F00F0523223BF","technicalSpecifications":"","manufacturer":"MS","contractStatus":"inLease","isCarbonZero":true,"acceptanceCertificateId":5018031,"invoiceGroupNumber":5277,"periodicalPrice":107.91,"usagePeriod":"quarterly","currency":"GBP","customerSpecificFields":{}},{"customerContext":{"customerName":"CORPORATION","leaseCompanyName":"C Limited","customerNumber":8233247,"leaseCompany":41},"assetId":410280320,"description":"Tablet PC Surface Pro 9 13,0","class":"TBL","category":"hardware","leaseScheduleId":6014522,"leaseStartDate":"2024-01-01","plannedLeaseEndDate":"2026-12-31","minimumLeaseTermEndDate":"2026-12-31","serialNumber":"0F00J9P23233BF","technicalSpecifications":"","manufacturer":"MS","contractStatus":"inLease","isCarbonZero":true,"acceptanceCertificateId":5018031,"invoiceGroupNumber":5277,"periodicalPrice":107.91,"usagePeriod":"quarterly","currency":"GBP","customerSpecificFields":{}},{"customerContext":{"customerName":"CORPORATION","leaseCompanyName":"CLimited","customerNumber":822347,"leaseCompany":21},"assetId":410280330,"description":"Tablet PC Surface Pro 9 13,0","class":"TBL","category":"hardware","leaseScheduleId":6014522,"leaseStartDate":"2024-01-01","plannedLeaseEndDate":"2026-12-31","minimumLeaseTermEndDate":"2026-12-31","serialNumber":"0F00JCD23093BF","technicalSpecifications":"","manufacturer":"MS","contractStatus":"inLease","isCarbonZero":true,"acceptanceCertificateId":5018031,"invoiceGroupNumber":5277,"periodicalPrice":107.91,"usagePeriod":"quarterly","currency":"GBP","customerSpecificFields":{}}

0 REPLIES 0