+ Start a Discussion
Raksha NarayanRaksha Narayan 

Remove brackets and separate the field with semi colon in apex

I have a string in apex controller stored as follows: String qtr={"Forecast_Category__c":["Unqualified","Not addressable"],"StageName":["1. Understand Customer","2. Discover Needs"]}. 
is it possible to store the following in the below format?
{Forecast_Category__c:[Unqualified,Not addressable] StageName:[1. Understand Customer,2. Discover Needs]}. 
3 Creeks3 Creeks
The string you have is a JSON formatted string so you can use the built in Apex JSON parsing methods to process it.  Take  look at those in the programming guide.
Maharajan CMaharajan C
Try the below one: 

system.debug( ' ==>  ' + qtr.remove('"').replace('],', '];'));

Thanks,
Maharajan.C