Grouping CSV Properties into JSON Objects
If you would like to group certain properties within your JSON object but are uploading a CSV dataset, you can use a naming convention that allows you to import the data as a JSON object.
For example, let's take this pokemon.csv dataset example.
#,Name,Type 1,Type 2,Total,HP,Attack,Defense,Sp. Atk,Sp. Def,Speed,Generation,Legendary
1,Bulbasaur,Grass,Poison,318,45,49,49,65,65,45,1,False
2,Ivysaur,Grass,Poison,405,60,62,63,80,80,60,1,False
As you can see, we are grouping the Sp. Atk and Sp. Def together.
By using this naming convention, it allows our data to appear as follows when being used on the endpoints.
{
"Sp": {
"_Atk": 65,
"_Def": 65
},
"#": 1,
"Attack": 49,
"Defense": 49,
"Generation": true,
"HP": 45,
"Legendary": false,
"Name": "Bulbasaur",
"Speed": 45,
"Total": 318,
"Type_1": "Grass",
"Type_2": "Poison"
}