I have two lists, Parent and Child. The Child list has a lookup field called "Parent", which "looks into" the Parent list, using ID column.
Using CSOM I'm joining the lists with this query
<View>
<Joins>
<Join Type='LEFT' ListAlias='Parent'>
<Eq>
<FieldRef Name='Parent' RefType='ID' />
<FieldRef List='Parent' Name='ID' />
</Eq>
</Join>
</Joins>
</View>
What returns is something along the lines of
[
{Title: "Child 1.1", Parent: "Parent 1", Parent_x003a_Desc: "foo"},
{Title: "Child 1.2", Parent: "Parent 1", Parent_x003a_Desc: "foo"},
{Title: "Child 1.3", Parent: "Parent 1", Parent_x003a_Desc: "foo"},
{Title: "Child 1.4", Parent: "Parent 1", Parent_x003a_Desc: "foo"},
{Title: "Child 2.1", Parent: "Parent 2", Parent_x003a_Desc: "foo"},
{Title: "Child 2.2", Parent: "Parent 2", Parent_x003a_Desc: "foo"}
]
Where the Parent values are duplicated in each row and there's no structure.
Is it at all possible to retrieve a structured response, e.g.
[
{
Title: "Parent 1",
Parent_x003a_Desc: "foo",
Children: [
{Title: "Child 1.1"},
{Title: "Child 1.2"},
{Title: "Child 1.3"},
{Title: "Child 1.4"}
]
},
{
Title: "Parent 2",
Parent_x003a_Desc: "foo",
Children: [
{Title: "Child 2.1"},
{Title: "Child 2.2"}
]
}
]