# How to genrate the property list inside the repeated loop?

**URL:** <https://forums.eggplantsoftware.com/t/how-to-genrate-the-property-list-inside-the-repeated-loop/8505>\
**Category:** Uncategorized\
**Created:** [June 16, 2023, 5:11am UTC](https://forums.eggplantsoftware.com/t/how-to-genrate-the-property-list-inside-the-repeated-loop/8505 "2023-06-16T05:11:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thanagaraj](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/t/e495f1/32.png) [@Thanagaraj](https://forums.eggplantsoftware.com/u/Thanagaraj)\
**Post date:** [June 16, 2023, 5:11am UTC](https://forums.eggplantsoftware.com/t/how-to-genrate-the-property-list-inside-the-repeated-loop/8505/1 "2023-06-16T05:11:55Z")

</div>

Hello Team,

I am getting Json like format from my API. In that I need to create couple of list and property list using repeat loop.

Below code I tried using this i can able genrate the required list.  
But how to genrated the property list inside the repeated loop? so that I can use for later validation

put [{“name”:“Test1”,“Age”:20,“depat”:“Eng”,“Loc”:“COB”,“Type”:“H”},{“name”:“Test2”,“Age”:30,“depat”:“Phy”,“Loc”:“KOR”,“Type”:“M”},{“name”:“Test3”,“Age”:25,“depat”:“Che”,“Loc”:“PUN”,“Type”:“S”}] into Test\_list  
log Test\_list  
set the listInsertionMode to “nested”

repeat with each item of Test\_list  
put it into inner\_value  
repeat with each item of inner\_value  
insert it.name into name  
insert it.Age into Age  
insert it.depat into depat  
insert it.Loc into Loc  
insert it.Type into Type  
nsert “”&singlequote&it.rgrId&&singlequote&“:”&singlequote&it.rtyDesc&singlequote into Test  
end repeat  
end repeat  
log name  
log Age  
log Loc  
log Type  
log “-----------------”  
log Test  
log “-----------------”

My excepectation of Test result should be:  
{“Test1”:20,“Test2”:30,“Test3”:25,}

---

<div class="post-metadata">

**Author:** ![Karsten](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/k/e47c2d/32.png) [@Karsten](https://forums.eggplantsoftware.com/u/Karsten)\
**Post date:** [June 19, 2023, 1:22pm UTC](https://forums.eggplantsoftware.com/t/how-to-genrate-the-property-list-inside-the-repeated-loop/8505/2 "2023-06-19T13:22:12Z")

</div>

Hey Thanagaraj,

for the json return from an api you can use _jsonvalue_ [URL Transactions and Formatting | EPF Docs (eggplantsoftware.com)](https://docs.eggplantsoftware.com/studio/stk-url-transactions-formatting/#json-value-function-anchor)

Basically you want to have a list containing all values for the keys Test? into a new property list where the value of name is the new key?  
you can use the following to print all keys values

```auto
put the name of each item of test_list 
put the age of each item of test_list

```

Cheers,  
Karsten

---

<div class="post-metadata">

**Author:** ![SenseTalkDoug](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/sensetalkdoug/32/88_2.png) [@SenseTalkDoug](https://forums.eggplantsoftware.com/u/SenseTalkDoug)\
**Post date:** [June 21, 2023, 2:58pm UTC](https://forums.eggplantsoftware.com/t/how-to-genrate-the-property-list-inside-the-repeated-loop/8505/3 "2023-06-21T14:58:20Z")

</div>

I’m not sure I understand your intent, but this script gives the result you said you wanted, so perhaps it will give you an idea of how to get there:

```auto
put [{"name":"Test1","Age":20,"depat":"Eng","Loc":"COB","Type":"H"},{"name":"Test2","Age":30,"depat":"Phy","Loc":"KOR","Type":"M"},{"name":"Test3","Age":25,"depat":"Che","Loc":"PUN","Type":"S"}] into Test_list

set testAges to {}
repeat with each item of Test_list
	set testAges.(it.name) to it.age
end repeat

put testAges

```

This displays the result you asked for: `{Test1:20, Test2:30, Test3:25}`

---

<div class="post-metadata">

**Author:** ![Thanagaraj](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/t/e495f1/32.png) [@Thanagaraj](https://forums.eggplantsoftware.com/u/Thanagaraj)\
**Post date:** [January 8, 2024, 10:06am UTC](https://forums.eggplantsoftware.com/t/how-to-genrate-the-property-list-inside-the-repeated-loop/8505/4 "2024-01-08T10:06:20Z")

</div>

Hello Team,

Using above suggestion I have create the property list in repeated loop. But I am getting @ front of key. How to remove “@”?

my code

set costRate to {}  
repeat for each item of validrgrID  
log it  
log “------------------------------”  
set CostRateURL to “URL”  
put sampleGet(url:CostRateURL) into CostRateResult  
put JSONValue(CostRateResult.responseBody) into universal CostRateData  
//put the rgrId of any item of universal CostRateData into rgrIdValue  
//log rgrIdValue  
put the svs of any item of universal CostRateData into svsValue  
if svsValue is empty  
put 0 into svsValue  
end if  
set costRate.(it) to svsValue  
log costRate  
end repeat

output:

1/8/24, 11:00:35 AM Log {@“1024429”:0.01, @“1024430”:1, @“1024431”:1, @“1026730”:0.01, @“1030250”:0.01, @“1032017”:120.5, @“1032423”:120.5, @“1032898”:0, @“1034326”:0, @“1034660”:120.5, @“1034661”:120.5, @“1034662”:120.5}

---

<div class="post-metadata">

**Author:** ![DaveHester](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/davehester/32/104_2.png) [@DaveHester](https://forums.eggplantsoftware.com/u/DaveHester)\
**Post date:** [January 8, 2024, 4:28pm UTC](https://forums.eggplantsoftware.com/t/how-to-genrate-the-property-list-inside-the-repeated-loop/8505/5 "2024-01-08T16:28:03Z")

</div>

I would recommend that you insert a breakpoint and take a look in the Variable Watcher pane. I think that you will find the “@” symbols are not part of the data but rather display only in the log because of how property lists are rendered in log files.
