I am iterating through an array with an forEach loop and each time I get an JSON object and each time I want to get certain values from the JSON object but somehow this does not work. console.log(json.responseJSON)
always returns undefined
.
The code looks like this:
searchterms = ["a", "b","c"];
searchterms.forEach(function(entry) {
console.log(entry);
json = $.getJSON('https://www.markerapi.com/api/v1/trademark/searchall/'+entry+'/wordcount/2/limit/20/username/XXX/password/XXX')
console.log(json);
console.log(json["responseJSON"])
});
The JSON for the first item in the array looks like this:
responseJSON: {"count":1,"trademarks":[{"serialnumber":"71045585","wordmark":"A","code":"GS0371","description":"WRITING AND PRINTING PAPER","registrationdate":"04\/08\/1913"}]}"
Later on I planned to get the "wordmark" and the "description" value from the JSON. How would I do this?
Thank you for any help!