I do not understand how to get standard JSON from an Oriijs request. I see people talking about "serializing" the result, but I don’t understand why and how to do it. There is a method toJSON(), but I see that it is used with fetchplans, etc.
I am trying to transfer a stream to a csv file and it is not working properly due to incorrect JSON format.
I would like to explain how and when to serialize. :-)
My request:
return db.query(
`SELECT
id,
name,
out('posted_to').name as page,
out('posted_to').id as page_id,
out('posted_to').out('is_language').name as language,
out('posted_to').out('is_network').name as network
FROM post
WHERE posted_at
BETWEEN
'${since}'
AND
'${until}'
UNWIND
page,
page_id,
language,
network
`
My result:
[ { '@type': 'd',
id: '207109605968597_1053732754639607',
name: '10 maneiras pelas quais você está ferindo seus relacionamentos',
page: 'Eu Amo o Meu Irmão',
page_id: '207109605968597',
language: 'portuguese',
network: 'facebook',
'@rid': { [String: '#-2:1'] cluster: -2, position: 1 },
'@version': 0 },
{ '@type': 'd',
id: '268487636604575_822548567865143',
name: '10 maneiras pelas quais você está ferindo seus relacionamentos',
page: 'Amo meus Filhos',
page_id: '268487636604575',
language: 'portuguese',
network: 'facebook',
'@rid': { [String: '#-2:3'] cluster: -2, position: 3 },
'@version': 0 }]