function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC ADM 7SFDC ADM 7 

Output text result in JSON format

Hi All,
When I click on command button I am showing data in outputtext
Data which is showing in output text I want to show it in JSON format.
How can I do this one?
Please help me

Thanks in Advance
Ginny MahantGinny Mahant
Hi,

   To understand the context, could you please explain the details like are you developing this VF page for SF Classic or are you developing components in Lightning Experience ? Accordingly, what funtion/action of the controller is the command button invoking assuming its returning response in JSON ? 
SFDC ADM 7SFDC ADM 7
We are developing for VF page
GauravGargGauravGarg
Use serialize() method to convert normal object text into JSON format:
 
JSON.serialize(var)

Look into this document for more info: JSON (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_System_Json.htm)

Thanks