How to prepare a dynamic key in records

Hi 

I am working on the outsytem project where i came accross this scenario, Scenario is  i need to prepare data like 

[ {"Ravi":[{"id":"12112","name":"abc","marks":"23"}{"id":"232","name":"sss","marks":"25"}]}.

{"Raj":[{"id":"12112","name":"abc","marks":"23"}{"id":"232","name":"sss","marks":"25"}]}.

{"Sri":[{"id":"12112","name":"abc","marks":"23"}{"id":"232","name":"sss","marks":"25"}]}]

So here i am preparing the data like key will be name of the person and data will be the list of their records.

How can i prepare the object to place these type of data and how can i give the field name as key

Can any one help me on it? 




Hi Laxmi,

Where are you preparing this data and where do you intend to display this?

Thanks

Junaid

Solution

Hi Laxmi,

Can you elaborate on your requirement. 

If this is a list of records you would like to make then, you can create a structure for marks. You can do it by the following steps 

1) Data Tab -> Structures -> Right click and select "Add Structure from Json" and paste the json 

 {"id":"12112","name":"abc","marks":"23"} 

 This will create a single structure you can name it Mark 

2) Create another structure called Student Marks having two fields 

   i) Name 

   ii) Marks (a List of Mark structure)

Hope it helps 

Solution

Amal Raj wrote:

Hi Laxmi,

Can you elaborate on your requirement. 

If this is a list of records you would like to make then, you can create a structure for marks. You can do it by the following steps 

1) Data Tab -> Structures -> Right click and select "Add Structure from Json" and paste the json 

 {"id":"12112","name":"abc","marks":"23"} 

 This will create a single structure you can name it Mark 

2) Create another structure called Student Marks having two fields 

   i) Name 

   ii) Marks (a List of Mark structure)

Hope it helps 


Hi Raj,

If i want to get the list from the data by using the name of person how can i fetch? Like in Java we can get it by key we can get the value. Is there any way if i can get by name of person Marks list?