You can achieive this via microflow.
Create a Export mapping and Message Definition for the entity which you need to convert them as a JSON String.
Create a microflow add an activity Export Mapping and call the export mapping which you created and pass the object as parameter and Set the content type as JSON and Return variable as String.
Now, this activity will return the entity data in the form of JSON String.
Note : I already posted the same answer in this post too : https://forum.mendix.com/link/questions/109298