Whenever I am calling my contract view method using near-cli, it is working fine, the terminal outputs the result correctly in JSON format.
But when I call the same method using near-api-js method in my angular project, it gives an error:
Error: Uncaught (in promise): TypeError: JSON.stringify cannot serialize cyclic structures.
Output from near-cli for reference and also the expected output when I call the same method via near-api-js:
{
files: [
{
owner: 'some string',
key: 'some string',
cid: 'some string'
}
],
length: 1
}
What may be the cause of this and what's the solution?