I'm selecting custom fields from an object and using GROUP BY to return those fields without repeating them.
Something like this:
SELECT
Produto__r.Name,
Produto__r.Id,
Produto__r.Id_Test__c
FROM
Veiculos__c
WHERE
Ativo__c = true
AND
Produto__r.Marca__c = 'a02j0000004kRhJAAA'
GROUP BY
Produto__r.Name,
Produto__r.Id,
Produto__r.Id_Test__c
When I convert the result to json the output is an array of objects with two properties, one of those properties is what I need.
[
{
Id: [
"01tj0000001EbUZAA9",
"01tj0000001EbUZAA9"
],
any: "<sf:Name>Vehicle Name</sf:Name><sf:Id>01tj0000001EbUZAA9</sf:Id><sf:Id_Test__c>23</sf:Id_Test__c>"
}
]
I was expecting the content of property "any" to be my parsed object. I'm making something wrong or this is the correct result and I need to parse the XML manually?
Thanks in advance.
UPDATE:
I'm showing just one record but it will return more than one. I was expecting the property any to be my result like:
[
{
'Name': 'Vehicle Name',
'Id': '01tj0000001EbUZAA9',
'Id_Test__c': '23'
},
{
'Name': 'Vehicle Name',
'Id': '01tj0000001EbUZAA8',
'Id_Test__c': '24'
}
]
* UPDATE 2 *
Actually my question is HOW can I parse the value inside ANY
param
<sf:Name>Vehicle Name</sf:Name><sf:Id>01tj0000001EbUZAA9</sf:Id><sf:Id_Test__c>23</sf:Id_Test__c>
If I try to parse the string using simplexml_load_string
I get this error:
simplexml_load_string(): namespace error : Namespace prefix sf on Name is not defined
Sorry for the mess in this question :(