I load a json array with this format
[{
id = 1;
name = “test1”;
}, {
id = 2;
name = “test2”;
}, {
id = 3;
name = “test#”;
}, {
id = 4;
name = “test$”;
}]
And I have a class called MyClass(id: int, name: String)
. For each element in the json I want to create an instance of MyClass. objects containt an array of the json element. Would it be possible to do something like
for object in objects{
MyClass(object)
}
or how shall I parse the json?