Extracting director data from JSON

I have the below code to extract the directors names from the JSON response I get from the API however it just always returns null, null, null. Any ideas?

" //Number of officers
NumberOfOfficers = response.get(“active_count”);
info NumberOfOfficers;
nameList = Collection();
for each NumberOfOfficers in response
{
nameList.insert(response.getjson(“links:/items:/name”));
}
info nameList;
}
return “Complete”;"

Json Response I am getting

" * “{“responseText”:{“items”:[{“appointed_on”:“2021-11-01”,“address”:{“country”:“United Kingdom”,“locality”:“London”,“postal_code”:“SW1E 5NN”,“address_line_1”:“Victoria Street”,“premises”:“171”},“officer_role”:“secretary”,“name”:“CHEONG TUNG SING, Jane Christina”,“links”:{“officer”:{“appointments”:”/officers/LG_egxtJWL43Os-6mEhljPNd2jM/appointments"},“self”:"/company/00233462/appointments/SjlBhiCCMhBB3ugmmxZNa1Z82mU"}},{“date_of_birth”:{“year”:1973,“month”:11},“country_of_residence”:“England”,“occupation”:“Director”,“name”:“MICHEL, Berangere Andree Mireille”,“links”:{“self”:"/company/00233462/appointments/FE4G5d41wfGEuB-4QQE3FqWuuzI",“officer”:{“appointments”:"/officers/9215jCvRXjjcnqAxDJX6G7WOYjc/appointments"}},“officer_role”:“director”,“address”:{“address_line_2”:“London”,“postal_code”:“SW1E 5NN”,“address_line_1”:“171 Victoria Street”},“nationality”:“French”,“appointed_on”:“2015-09-01”},{“officer_role”:“director”,“links”:{“officer”:{“appointments”:"/officers/aRDye_Q4OUqBZmCj1lMA267OL6E/appointments"},“self”:"/company/00233462/appointments/ZjC5C1MUnqyRLXe1LQm8sU-mtHQ"},“appointed_on”:“2020-02-04”,“address”:{“country”:“United Kingdom”,“postal_code”:“SW1E 5NN”,“premises”:“171”,“address_line_1”:“Victoria Street”,“locality”:“London”},“nationality”:“British”,“name”:“WHITE, Sharon Michele”,“occupation”:“Chairman”,“country_of_residence”:“United Kingdom”,“date_of_birth”:{“month”:4,“year”:1967}},{“address”:{“country”:“United Kingdom”,“locality”:“London”,“postal_code”:“SW1E 5NN”,“address_line_1”:“Victoria Street”,“premises”:“171”},“appointed_on”:“2021-06-07”,“links”:{“self”:"/company/00233462/appointments/HB4s5iJ8uYkZgWA1sX1ELWo3XSQ",“officer”:{“appointments”:"/officers/wn3Fdtsn3A9ijq38UlYa6WN4evw/appointments"}},“resigned_on”:“2021-11-01”,“officer_role”:“secretary”,“name”:“BLACKBURN, Simon Jim”},{“appointed_on”:“2014-07-31”,“address”:{“postal_code”:“SW1P 1BX”,“country”:“United Kingdom”,“address_line_1”:“Carlisle Place”,“locality”:“London”,“premises”:“Partnership House”},“officer_role”:“secretary”,“name”:“BUCHANAN, Alan”,“resigned_on”:“2015-01-31”,“links”:{“self”:"/company/00233462/appointments/8kRwOI3G3inceERcRv7gFYUlmFM",“officer”:{“appointments”:"/officers/6-79WOdAxM6z4dSKxJcJVDKCzW0/appointments"}}},{“name”:“CASELY-HAYFORD, Margaret Henrietta Augusta”,“officer_role”:“secretary”,“links”:{“self”:"/company/00233462/appointments/wQl4eldhabK47WN7SbszTui_OsE",“officer”:{“appointments”:"/officers/UjLuEeottNZYMxCY3gDpLs5-xbQ/appointments"}},“resigned_on”:“2014-07-31”,“appointed_on”:“2006-04-28”,“address”:{“address_line_1”:“171 Victoria Street”,“locality”:“London”,“postal_code”:“SW1E 5NN”}},{“appointed_on”:“2015-02-01”,“address”:{“postal_code”:“SW1E 5NN”,“country”:“United Kingdom”,“premises”:“171”,“locality”:“London”,“address_line_1”:“Victoria Street”},“name”:“HUBBER, Keith Michael”,“officer_role”:“secretary”,“links”:{“self”:"/company/00233462/appointments/Q0LteFCu-Syom10ioT9Dr1htCYI",“officer”:{“appointments”:"/officers/yJnxJaUKrL-9txGBFBdpxrusD_U/appointments"}},“resigned_on”:“2018-01-31”},{“appointed_on”:“2001-05-10”,“address”:{“postal_code”:“SW1E 5NN”,“locality”:“London”,“address_line_1”:“171 Victoria Street”},“name”:“NEVILLE, Terence Frank”,“officer_role”:“secretary”,“links”:{“self”:"/company/00233462/appointments/CgEemxuQJE5mTi92xQ2oGshsYWQ",“officer”:{“appointments”:"/officers/R2yZiYHdGCIuUudWHaAsgRFxHtE/appointments"}},“resigned_on”:“2006-04-27”},{“officer_role”:“secretary”,“name”:“PRITCHARD, Brian James”,“resigned_on”:“2001-05-09”,“links”:{“officer”:{“appointments”:"/officers/zTn1prjjtL12GNATDVGxlaSpDpU/appointments"},“self”:"/company/00233462/appointments/SiAJVi5yl8sfRL3TaHrXkvoQZiU"},“address”:{“address_line_1”:“The Chase, Garden Close Lane”,“address_line_2”:“Wash Common”,“locality”:“Newbury”,“postal_code”:“RG14 6PP”,“region”:“Berkshire”}},{“address”:{“postal_code”:“SW1E 5NN”,“locality”:“London”,“address_line_1”:“Victoria Street”,“premises”:“171”,“country”:“United Kingdom”},“appointed_on”:“2018-01-31”,“links”:{“self”:"/company/00233462/appointments/VcwvWhG2isrR48Vfqlm_GfL48Lc",“officer”:{“appointments”:"/officers/pFqcA4eqHE_jFpF_pRBpdg3jAe4/appointments"}},“resigned_on”:“2021-06-07”,“name”:“SIMPSON, Peter”,“officer_role”:“secretary”},{“links”:{“officer”:{“appointments”:"/officers/RY64rYPEaYutNFQUXeLVK94PVBo/appointments"},“self”:"/company/00233462/appointments/zIG-wRRzJPx8qpX2oRWhEJ6YIPA"},“resigned_on”:“2005-11-27”,“officer_role”:“director”,“address”:{“locality”:“London”,“postal_code”:“SW1E 5NN”,“address_line_1”:“171 Victoria Street”},“nationality”:“British”,“appointed_on”:“1993-07-22”,“date_of_birth”:{“month”:3,“year”:1950},“occupation”:“Director”,“name”:“ALEXANDER, Ian David”},{“occupation”:“Director Of Building & Svc”,“name”:“CARPENTER, John Barnard Grantley”,“date_of_birth”:{“month”:4,“year”:1936},“officer_role”:“director”,“resigned_on”:“1999-12-24”,“links”:{“officer”:{“appointments”:"/officers/GKVoR4S0RRA31V5ovI9dXS9Mgp8/appointments"},“self”:"/company/00233462/appointments/zW4w34gwzYShnMcTjnvB-CC-LFs"},“nationality”:“British”,“address”:{“postal_code”:“N1 2PB”,“address_line_1”:“Flat 4”,“address_line_2”:“50 Compton Road”,“locality”:“London”}},{“name”:“CASSONI, Marisa Luisa”,“occupation”:“Director”,“date_of_birth”:{“month”:12,“year”:1951},“country_of_residence”:“United Kingdom”,“officer_role”:“director”,“resigned_on”:“2012-06-01”,“links”:{“self”:"/company/00233462/appointments/mqpTYB2vpRVr4s85fKFn9OFIcxo",“officer”:{“appointments”:"/officers/mfKR_kFIwUX_074RQmkcFPDXE7E/appointments"}},“appointed_on”:“2006-07-20”,“nationality”:“British”,“address”:{“address_line_1”:“Victoria Street”,“premises”:“171”,“country”:“United Kingdom”,“locality”:“London”,“postal_code”:“SW1E 5NN”}},{“officer_role”:“director”,“resigned_on”:“2002-12-30”,“links”:{“self”:"/company/00233462/appointments/kGpGTGSwCkieJJqUDqEnxc9Xuwc",“officer”:{“appointments”:"/officers/7u04zPDUB02c374UaOxIet-YQ7s/appointments"}},“nationality”:“British”,“address”:{“postal_code”:“SE16 5ES”,“address_line_1”:“Flat 40 Canada Wharf”,“address_line_2”:“255 Rotherhithe Street”,“locality”:“London”},“occupation”:“Director”,“name”:“CLOAKE, Dudley Richard”,“date_of_birth”:{“month”:10,“year”:1943}},{“officer_role”:“director”,“resigned_on”:“2007-04-24”,“links”:{“self”:"/company/00233462/appointments/OOI7ORQqc5Eqa_E0zNUycPoxKrg",“officer”:{“appointments”:"/officers/Y7pkx0D7O4Ii7Bri_UHSxRFQ2Vk/appointments"}},“appointed_on”:“2002-03-11”,“address”:{“address_line_1”:“171 Victoria Street”,“postal_code”:“SW1E 5NN”,“locality”:“London”},“nationality”:“British”,“name”:“ESOM, Steven Derek”,“occupation”:“Director”,“date_of_birth”:{“year”:1960,“month”:11}},{“name”:“FALCONER, Peter”,“occupation”:“Dir Of Buying Waitrose”,“date_of_birth”:{“year”:1936,“month”:6},“nationality”:“British”,“address”:{“region”:“Buckinghamshire”,“postal_code”:“HP9 2LS”,“address_line_1”:“Pennfields Penn Road”,“locality”:“Beaconsfield”},“officer_role”:“director”,“resigned_on”:“1996-06-20”,“links”:{“officer”:{“appointments”:"/officers/5QfusxJUs8tjNdktA8-eFh_4KR4/appointments"},“self”:"/company/00233462/appointments/cmuIKMt5e7hHU3ZqOO5n8fNHNgc"}},{“occupation”:“Director”,“name”:“FELWICK, David Leonard”,“country_of_residence”:“United Kingdom”,“date_of_birth”:{“month”:11,“year”:1944},“officer_role”:“director”,“resigned_on”:“2004-09-03”,“links”:{“self”:"/company/00233462/appointments/xEw7wzqvPXVerBD5zBBlSHrHClg",“officer”:{“appointments”:"/officers/IGR0tRIrEJLe9aOqpq6HKK0YQvg/appointments"}},“address”:{“address_line_1”:“171 Victoria Street”,“locality”:“London”,“postal_code”:“SW1E 5NN”},“nationality”:“British”},{“date_of_birth”:{“year”:1963,“month”:4},“country_of_residence”:“United Kingdom”,“name”:“FLEMING, Ian Ashley”,“occupation”:“Corporate Treasurer”,“links”:{“self”:"/company/00233462/appointments/lX3ZnecXIYk40_fxXFG4wCNwkuQ",“officer”:{“appointments”:"/officers/qz_s_XofN-6uI3M0dJ2_ky-tMk8/appointments"}},“resigned_on”:“2014-08-15”,“officer_role”:“director”,“address”:{“address_line_1”:“Victoria Street”,“postal_code”:“SW1E 5NN”,“country”:“England”,“premises”:“171”,“locality”:“London”},“nationality”:“British”,“appointed_on”:“2013-01-23”},{“occupation”:“Director Of Buying”,“name”:“FLETCHER, Leslie Herbert”,“date_of_birth”:{“year”:1934,“month”:12},“officer_role”:“director”,“resigned_on”:“1993-07-22”,“links”:{“self”:"/company/00233462/appointments/IdhgBzeU4XDTZ7KfIFo9S_XFXO4",“officer”:{“appointments”:"/officers/q8rUfTg9ReOWQ42Fxj_985U7kek/appointments"}},“address”:{“locality”:“London”,“postal_code”:“W9 1DR”,“address_line_1”:“26 Randolph Crescent”,“address_line_2”:“Maida Vale”},“nationality”:“British”},{“date_of_birth”:{“month”:1,“year”:1947},“name”:“HAMPSON, Stuart”,“occupation”:“Chairman”,“address”:{“postal_code”:“SW1E 5NN”,“address_line_1”:“171 Victoria Street”,“locality”:“London”},“nationality”:“British”,“resigned_on”:“2007-04-01”,“links”:{“officer”:{“appointments”:"/officers/SyyN7PxI8QQUZrvehg0-EizSUOU/appointments"},“self”:"/company/00233462/appointments/WfJlzcsZy9MafymMxVr9E32zaZ8"},“officer_role”:“director”},{“country_of_residence”:“United Kingdom”,“date_of_birth”:{“month”:4,“year”:1951},“occupation”:“Alternate Director”,“name”:“HAUFF, Reyn”,“nationality”:“British”,“address”:{“postal_code”:“SW1E 5NN”,“address_line_1”:“171 Victoria Street”,“address_line_2”:“London”},“appointed_on”:“2009-12-15”,“resigned_on”:“2015-01-27”,“links”:{“officer”:{“appointments”:"/officers/omUi4DNkWt4QIRW1kL_f0pUN7RM/appointments"},“self”:"/company/00233462/appointments/pd3hA_x_mShgFI9Bg1kHjprOqpo"},“officer_role”:“director”},{“name”:“KILLEN, Tracey Anne”,“occupation”:“Director”,“date_of_birth”:{“year”:1961,“month”:4},“officer_role”:“director”,“resigned_on”:“2020-07-10”,“links”:{“officer”:{“appointments”:"/officers/dtPbNs3Lol4aKeZsqfPAkQ9avO8/appointments"},“self”:"/company/00233462/appointments/0UK92WHgEwT4S9vizIE8rqvSg70"},“appointed_on”:“2007-04-30”,“address”:{“postal_code”:“SW1E 5NN”,“locality”:“London”,“address_line_1”:“171 Victoria Street”},“nationality”:“British”},{“date_of_birth”:{“month”:7,“year”:1965},“country_of_residence”:“England”,“name”:“LEWIS, John Patrick”,“occupation”:“Retailer”,“address”:{“address_line_2”:“London”,“address_line_1”:“171 Victoria Street”,“postal_code”:“SW1E 5NN”},“nationality”:“British”,“appointed_on”:“2015-09-14”,“resigned_on”:“2020-12-31”,“links”:{“officer”:{“appointments”:"/officers/6Q-pEybtm-yGmGJFk3txQCDKKRA/appointments"},“self”:"/company/00233462/appointments/TqXPzq3XC3CXcjGcfSFzXAZSDtY"},“officer_role”:“director”},{“name”:“LEWIS, Peter Tyndale”,“occupation”:“Chairman”,“date_of_birth”:{“month”:9,“year”:1929},“nationality”:“British”,“address”:{“postal_code”:“W8 5RA”,“locality”:“London”,“address_line_1”:“Flat No 1-34 Victoria Road”},“officer_role”:“director”,“links”:{“self”:"/company/00233462/appointments/aag-sfAcOvD-Dd-B6W7QgI6DJis",“officer”:{“appointments”:"/officers/ukkfNL-7vob5On-Hb_SMMZA7if4/appointments"}},“resigned_on”:“1993-02-01”},{“name”:“MAYFIELD, Andrew Charles, Sir”,“occupation”:“Director”,“country_of_residence”:“United Kingdom”,“date_of_birth”:{“year”:1966,“month”:12},“appointed_on”:“2001-09-24”,“address”:{“address_line_1”:“171 Victoria Street”,“locality”:“London”,“postal_code”:“SW1E 5NN”},“nationality”:“British”,“officer_role”:“director”,“links”:{“self”:"/company/00233462/appointments/OlBpEAcID9UDPXIG-r25PRw4sOc",“officer”:{“appointments”:"/officers/nY4vtPx5_W_TFSFr9ZHZK2AvzYE/appointments"}},“resigned_on”:“2020-02-04”},{“occupation”:“Director”,“name”:“MAYHEW, Christopher Luke”,“date_of_birth”:{“month”:6,“year”:1953},“appointed_on”:“1993-07-22”,“address”:{“postal_code”:“SW1E 5NN”,“address_line_1”:“171 Victoria Street”,“locality”:“London”},“nationality”:“British And New Zealand”,“officer_role”:“director”,“links”:{“self”:"/company/00233462/appointments/7zhAi72Q7yqLCYcjA2lzIo2bExA",“officer”:{“appointments”:"/officers/0nCJIzMpj-a31CprpQYzXcJt5rM/appointments"}},“resigned_on”:“2004-12-24”},{“occupation”:“Alternate Director”,“name”:“MICHEL, Berangere Andree Mireille”,“date_of_birth”:{“month”:11,“year”:1973},“country_of_residence”:“England”,“appointed_on”:“2009-12-15”,“address”:{“address_line_2”:“London”,“address_line_1”:“171 Victoria Street”,“postal_code”:“SW1E 5NN”},“nationality”:“French”,“officer_role”:“director”,“links”:{“self”:"/company/00233462/appointments/QhBfTLMMyV3BOMNVhpUeYXfhkQc",“officer”:{“appointments”:"/officers/9215jCvRXjjcnqAxDJX6G7WOYjc/appointments"}},“resigned_on”:“2015-01-27”},{“appointed_on”:“2017-01-11”,“nationality”:“British”,“address”:{“postal_code”:“SW1E 5NN”,“country”:“United Kingdom”,“locality”:“London”,“address_line_1”:“Victoria Street”,“premises”:“171”},“officer_role”:“director”,“resigned_on”:“2020-01-23”,“links”:{“officer”:{“appointments”:"/officers/TwWlcETK6LItT8ItaFPIWBmO300/appointments"},“self”:"/company/00233462/appointments/BhPtrUrB9ULmPWIzNykPuzUd60s"},“name”:“NICKOLDS, Paula Margaret”,“occupation”:“Retail Buyer”,“date_of_birth”:{“year”:1973,“month”:2},“country_of_residence”:“United Kingdom”},{“officer_role”:“director”,“links”:{“self”:"/company/00233462/appointments/iqHmTD-CwuC1h45CFK6OKivkaZc",“officer”:{“appointments”:"/officers/kwYpFR6DRLbKZ5lKEyu_lcjm8jo/appointments"}},“resigned_on”:“2000-01-28”,“nationality”:“British”,“address”:{“locality”:“Clifton”,“postal_code”:“SG17 5EQ”,“region”:“Bedfordshire”,“address_line_1”:“2 Clifton House Close”},“occupation”:“Director Of Trading (Ds)”,“name”:“O’CALLAGHAN, Brian Anthony”,“date_of_birth”:{“year”:1942,“month”:6}},{“resigned_on”:“1993-09-09”,“links”:{“officer”:{“appointments”:"/officers/_rAzQsjw0g4twigk043K-1SDwWE/appointments"},“self”:"/company/00233462/appointments/_tSp6RfAW2F_InIvrm98vUhnY-s"},“officer_role”:“director”,“address”:{“region”:“Surrey”,“postal_code”:“KT1 2TL”,“locality”:“Kingston Upon Thames”,“address_line_1”:“19 Lingfield Avenue”},“nationality”:“British”,“date_of_birth”:{“year”:1937,“month”:11},“occupation”:“Managing Director Of Store”,“name”:“ORYAN, Peter Jerome Francis”},{“resigned_on”:“2015-08-31”,“links”:{“self”:"/company/00233462/appointments/Cs7XzKocUp_A6HmPAjNsPnUox_w",“officer”:{“appointments”:"/officers/h6xlBnvtjnhKmSNxbYkAql8MYKM/appointments"}},“officer_role”:“director”,“address”:{“premises”:“171”,“postal_code”:“SW1E 5NN”,“country”:“England”,“locality”:“London”,“address_line_1”:“Victoria Street”},“nationality”:“British”,“appointed_on”:“2013-01-23”,“date_of_birth”:{“month”:3,“year”:1965},“country_of_residence”:“United Kingdom”,“occupation”:“Finance Director”,“name”:“OSBORNE, Rachel Claire Elizabeth”},{“links”:{“self”:"/company/00233462/appointments/X3qOK2-YZ8xUCYstfSrz3gAIGmM",“officer”:{“appointments”:"/officers/PBkZA2r7wAiDaG83DKUa73f03gc/appointments"}},“resigned_on”:“2016-03-18”,“officer_role”:“director”,“nationality”:“British”,“address”:{“address_line_1”:“171 Victoria Street”,“locality”:“London”,“postal_code”:“SW1E 5NN”},“appointed_on”:“2005-01-30”,“date_of_birth”:{“year”:1961,“month”:3},“country_of_residence”:“United Kingdom”,“name”:“PRICE, Mark Ian”,“occupation”:“Director”},{“nationality”:“British”,“address”:{“postal_code”:“SW15 6UQ”,“locality”:“London”,“address_line_1”:“9 Woodthorpe Road”},“resigned_on”:“1993-07-22”,“links”:{“officer”:{“appointments”:"/officers/pWfMm6kvGhTlge1nP83FmEoj55U/appointments"},“self”:"/company/00233462/appointments/appCG1rSqNXXdAkswUMmHtiLFl0"},“officer_role”:“director”,“date_of_birth”:{“month”:7,“year”:1933},“occupation”:“Director Of Buying”,“name”:“QUINN, Jean Margaret”},{“name”:“STILL, Peter Walker Kenneth”,“occupation”:“Managing Director Of Store”,“date_of_birth”:{“month”:1,“year”:1948},“nationality”:“British”,“address”:{“address_line_1”:“Clavering Darkes Lane”,“locality”:“Potters Bar”,“postal_code”:“EN6 1DB”,“region”:“Hertfordshire”},“officer_role”:“director”,“links”:{“officer”:{“appointments”:"/officers/fI1KnbIk7P4P8058jgtI-C964gI/appointments"},“self”:"/company/00233462/appointments/wYaI1PpbWhn3owF30D6zSHNXU1s"},“resigned_on”:“1993-09-09”},{“links”:{“officer”:{“appointments”:"/officers/dRaTsmSngmqooL38YT7135jT0mw/appointments"},“self”:"/company/00233462/appointments/a6hUKlhtvwqn-cuUf1Lkw5i0p_o"},“resigned_on”:“2016-10-28”,“officer_role”:“director”,“address”:{“locality”:“London”,“address_line_1”:“171 Victoria Street”,“postal_code”:“SW1E 5NN”},“nationality”:“British”,“appointed_on”:“2002-12-30”,“country_of_residence”:“United Kingdom”,“date_of_birth”:{“month”:6,“year”:1963},“occupation”:“Director”,“name”:“STREET, Andrew John”}],“active_count”:3,“inactive_count”:0,“items_per_page”:35,“etag”:“91446922a23f342c7af4a4753767c41f4c3ca339”,“resigned_count”:39,“kind”:“officer-list”,“start_index”:0,“links”:{“self”:"/company/00233462/officers"},“total_results”:42},“responseHeader”:{“date”:“Thu, 16 Mar 2023 16:12:01 GMT”,“content-length”:“16517”,“server”:“CompaniesHouse”,“x-ratelimit-limit”:“600”,“access-control-allow-headers”:“X-RateLimit-Query, origin, content-type, content-length, user-agent, host, accept, authorization”,“x-ratelimit-reset”:“1678983369”,“pragma”:“no-cache”,“access-control-expose-headers”:“Location,www-authenticate,cache-control,pragma,content-type,expires,last-modified”,“access-control-allow-credentials”:“true”,“access-control-max-age”:“3600”,“content-type”:“application/json”,“connection”:“keep-alive”,“x-ratelimit-remain”:“598”,“cache-control”:“no-store, no-cache, must-revalidate, post-check=0, pre-check=0”,“x-ratelimit-window”:“5m”},“responseCode”:200}"

//output

  • “3”
  • “null,null,null”"

It’s not really a query for here, and I don’t speak your language (Deluge)… but …

EDIT: the Response you list is indeed that from Deluge’s invokeURL task by the looks of it. The whole Response is not “JSON”. It’s a something (map? Collection? I don’t know what Deluge calls objects or this kind of object) which stores the response in the responseText member. It’s not clear from this whether the responseText field here contains JSON already parsed to key-value pairs (however Deluge describes this e.g. a map etc.) or whether this is indeed just a long string. This doesn’t really make any difference to what I’ve written below though!

Response contains:

"responseText": ... // (either a string OR key - value pairs, where the values may possibly be further maps)
"responseHeader": { }, // contains key-value pairs with the http response header
"responseCode": 200

END EDIT

  1. what is response? What type does it have? The API says it returns the structure given in this link. The Deluge manual says a response can be text, or key-value pairs, or a list.

  2. When you use for each what are you iterating over? (if you can do response.get(“active_count”), I’d expect this to iterate over all the values in response - but I don’t know Deluge.) I’d expect response here to be a map (has key->value pairs) rather than a list - with one of the keys being items which should contain a list of Officer resources. I suspect you want to iterate over each officer in the list within response, no?

Then - why are you (apparently) assigning something to NumberOfOfficers on each loop and then not using that? I would expect you to be using the variable here (or rather one with a more accurate title like officerItem) as officerItem.

Then - what is response.getjson(“links:/items:/name”)); ? Is there any such map here with structure links -> items -> name ? (Hint - clearly not where you are looking as you’re getting a null! Where is this links → items? You’ll find links → self at one level and links → officer and links → self in each officer item…)

What would something like the following do?

for each OfficerItem in response.get("items")
{
nameList.insert(OfficerItem.get("name")); // or whatever the syntax is to access the name member of Officeritem - assuming response.get("items") returns a map / collection
}

The language reference seems to say that getJson works on a JSON string or a Collection (key-value pairs?)