Trouble with codes Json

I keep getting this error message Im not a tech and dont rreally understand code, I use chatgpt but over and over again it give the code with the same error message, if anyone can help me fix this I’ll be most gracefull.
const zipCodes = [
“35111”, “35116”, “35117”, “35118”, “35209”, “35210”, “35211”,
“35211”, “35242”, “35243”, “35004”, “35243”, “35004”, “35052”,
“35112”, “35120”, “35173”, “35178”, “35953”, “35972”, “35987”,
“35137”, “35185”, “35144”, “35187”, “35143”, “35238”, “35176”,
“35078”, “35007”
];

// Loop through each zip code and make a request
zipCodes.forEach((zipCode) => {
pm.sendRequest({
url: https://api.gateway.attomdata.com/propertyapi/v1.0.0/property/detail?postalcode=${zipCode},
method: ‘GET’,
header: {
“apikey”: “407c795921dcf7f963309e42fae2a78c”
}
}, function (err, res) {
if (err) {
console.error(Error fetching data for zip code ${zipCode}:, err);
} else {
try {
// Parse JSON response
const jsonResponse = res.json();
console.log(Data for zip code ${zipCode}:, jsonResponse);
} catch (parseError) {
console.error(Failed to parse JSON for zip code ${zipCode}:, parseError);
console.log(‘Raw response:’, res.text());
}
}
});
});

What error are you getting?

Can you please use the preformatted text option in the editor when pasting code. It stops everything from being aligned to the left making it very hard to read.

If that is a real API key, you might want to edit your post and redact the info.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.