Returning a JSON from calling Moralis Cloud function

I want to convert the result returned by the Moralis Cloud function into a JSON format so that I can pass it into my react component as a PROP. However, I can’t convert it to a JSON.

My Moralis Cloud function:

//Get specific user based on eth address
Moralis.Cloud.define("getUser", async (request) => {
  const query = new Moralis.Query("_User", { useMasterKey: true });
  query.equalTo("ethAddress", request.params.ethAddress);
  const result = await query.first({ useMasterKey: true });

  return result;
});

Calling cloud function:

const user = await Moralis.Cloud.run("getUser", {
    ethAddress: profileEthAddress,
  });

user.attributes returns the following (in which I want to convert to JSON to pass in as a prop to my react component:

I have tried user.json() but they don’t allow me to.

You can pass in user or user.attributes in directly if you want to use these properties in your component. Otherwise you can convert the object to JSON string with JSON.stringify(user).