# How can i convert a array to a structure

**URL:** <https://forums.unrealengine.com/t/how-can-i-convert-a-array-to-a-structure/741274>\
**Category:** C++\
**Tags:** Struct, tarray, unreal-engine, Array, CPP, Blueprint, question\
**Created:** [January 3, 2023, 4:02pm UTC](https://forums.unrealengine.com/t/how-can-i-convert-a-array-to-a-structure/741274 "2023-01-03T16:02:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kaan\_Altay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kaan\_Altay](https://forums.unrealengine.com/u/Kaan_Altay)\
**Post date:** [January 3, 2023, 4:02pm UTC](https://forums.unrealengine.com/t/how-can-i-convert-a-array-to-a-structure/741274/1 "2023-01-03T16:02:47Z")

</div>

Hello everybody there is a node in unreal engine blueprint :

![Ekran görüntüsü 2023-01-03 185831](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/4/f34e3b8ce2302dafa8f4e9a2b1e73db9a654463d.png)  
how can i convert a array into struct in c++ for adding in a TMap?

I specifically want to do this in c++

![Ekran görüntüsü 2023-01-03 190357](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/0/1/e01877df3f620973d93e6e76e1ecd24e1fbb565e.png)

---

<div class="post-metadata">

**Author:** ![Megatron.THX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/megatron.thx/32/707762_2.png) [@Megatron.THX](https://forums.unrealengine.com/u/Megatron.THX)\
**Post date:** [January 3, 2023, 10:56pm UTC](https://forums.unrealengine.com/t/how-can-i-convert-a-array-to-a-structure/741274/2 "2023-01-03T22:56:29Z")

</div>

Hi @Kaan_Altay

“conver array into struct …” I think this would be more accurate:

I have made a little example with Skill Structs that are saved inside of 2 TArrays and these are stored inside a TMap.

# Code

```auto
struct Skill
{
	FString Name;
	int Level;
};

void ULibTools::test1(int i)
{
	UE_LOG(LogClass, Log, TEXT("test1-------------------"));

	TArray<Skill> SkillArray;

	Skill s1 = Skill();
	s1.Name = TEXT("Trunk");
	s1.Level = 2;
	SkillArray.Add(s1);

	Skill s2 = Skill();
	s2.Name = TEXT("Tank");
	s2.Level = 3;
	SkillArray.Add(s2);

	TMap<FString, TArray<Skill>> Root;

	Root.Add("Driving", SkillArray);

	TArray<Skill> SkillArray2;
	Skill s3 = Skill();
	s3.Name = TEXT("Eggs Fried");
	s3.Level = 3;
	SkillArray2.Add(s3);

	Skill s4 = Skill();
	s4.Name = TEXT("Pasta");
	s4.Level = 1;
	SkillArray2.Add(s4);

	Root.Add("Cooking", SkillArray2);

	for (auto& Category: Root)
	{
		UE_LOG(LogClass, Log, TEXT("Category: %s"), *Category.Key);
		for(auto& Skill: Category.Value){
			UE_LOG(LogClass, Log, TEXT(" %s, %i"), *Skill.Name, Skill.Level);
		}
	}
}

```

# Output:

LogClass: Category: Driving  
LogClass: Trunk, 2  
LogClass: Tank, 3  
LogClass: Category: Cooking  
LogClass: Eggs Fried, 3  
LogClass: Pasta, 1

would be this what you want? your Skills are already struct or anything else?

---

<div class="post-metadata">

**Author:** ![Kaan\_Altay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kaan\_Altay](https://forums.unrealengine.com/u/Kaan_Altay)\
**Post date:** [January 5, 2023, 7:33pm UTC](https://forums.unrealengine.com/t/how-can-i-convert-a-array-to-a-structure/741274/3 "2023-01-05T19:33:58Z")

</div>

I don’t think that is what i’m looking for. Thanks anyway.
