If i run this in Salesforce workbench I get one line with three lines under OpportunityLineItems
SELECT Amount, Account.Name, Account.AccountNumber, Name,
(
SELECT Quantity, UnitPrice, ProductCode,Product2.Name
FROM OpportunityLineItems
)
FROM Opportunity where Opportunity.Id IN ('07357Jez0204768')
The output looks like this Workbench query output
Whereas I want the output to be like the following Expected Workbench output
How can i get the expected output ? Do i need to change the way the query is written , if so how can i do it ?
UPDATE:
{
""attributes"": {
""type"": ""Opportunity"",
""url"": ""/services/data/v57.0/sobjects/Opportunity/q44l3KquPik6xxxxxxxx""
},
""Amount"": 115.00,
""AccountId"": ""ihdvg2cCRj6Dxxxxxxxx"",
""Name"": ""realtimetest"",
""Id"": ""q44l3KquPik6xxxxxxxx"",
""OpportunityLineItems"": {
""totalSize"": 1,
""done"": true,
""records"": [
{
""attributes"": {
""type"": ""OpportunityLineItem"",
""url"": ""/services/data/v57.0/sobjects/OpportunityLineItem/IWHHTghK6MA8xxxxxxxx""
},
""OpportunityId"": ""q44l3KquPik6xxxxxxxx"",
""Id"": ""IWHHTghK6MA8PzX8HQD9"",
""Quantity"": 4.00,
""UnitPrice"": 5.00,
""ProductCode"": ""product1Code"",
""Product2Id"": ""MFqTUKEOHojaxxxxxxxx"",
""Product2"": {
""attributes"": {
""type"": ""Product2"",
""url"": ""/services/data/v57.0/sobjects/Product2/MFqTUKEOHojaxxxxxxxx""
},
""Id"": ""MFqTUKEOHojaxxxxxxxx"",
""Name"": ""product1Name""
}
}
]
},
""Account"": {
""attributes"": {
""type"": ""Account"",
""url"": ""/services/data/v57.0/sobjects/Account/ihdvg2cCRj6Dxxxxxxxx""
},
""Id"": ""ihdvg2cCRj6Dxxxxxxxx"",
""Name"": ""My Test Opp""
}
}