You are not logged in.
On MVC application i have a model like this:
TSQLTag = class(TSQLSomeone)
private
published
end;
TSQLUser = class(TSQLSomeone)
private
published
end;
TSQLContact = class(TSQLSomeone)
private
published
end;
TSQLProject = class(TSQLRecordTimeStamped)
private
fUsers: TIntegerDynArray;
fContacts: TIntegerDynArray;
fTags: TIntegerDynArray;
...
published
property Users: TIntegerDynArray index 1 read fUsers write fUsers;
property Contacts: TIntegerDynArray index 2 read fContacts write fContacts
property Tags: TIntegerDynArray index 3 read fTags write fTags
...
end;
I need extract all projects and get all users, contacts and tags for each project. So I'd like get a JSON code like this:
"projects":
[
{
"ID": 1,
"Title": "example",
"Code": "12345",
"Users":
[
{
"LastName": "aaa"
"FirstName": "bbb",
},
{
"LastName": "ccc"
"FirstName": "ddd",
}
],
"Contacts":
[
{
"LastName": "eee"
"FirstName": "fff",
},
{
"LastName": "ggg"
"FirstName": "hhh",
}
],
"Tags":
[
{
"Name": "iii"
},
{
"Name": "lll"
}
]
}
],
Is there a way to do this?
What is the best way?
Offline