Can we get raw JSON instead of ParseObject as result of query?

I want to get raw json or array of json as query result. Is this possible?

Not sure if there’s any included functionality, but you could easily:

const results = query.find()
const jsonResults = results.map((obj) => obj.toJSON());

No. I know this. I want directly json. Parse server transform json to ParseObject. I want mongodb result without converting it to parse objects.

I added something similar to the PHP SDK a long time ago. We could add something like
query.find({ json: true }) or something similar

1 Like

Can I use this in cloud code? Same rules apply to js sdk?

Edit: I guess not.

Do you mean this function that you shared? Yes. The SDK in cloud code is the same you use in the client side.

No I meant can I use this(.find({json:true});) in cloud code. But seems like js sdk doesnt support it yet.

It is not available yet.

does this function work for restapi?

Yes. The REST API returns a JSON.