You need to sign in to do that
Don't have an account?
Hermann Ouré
Print key in json format
Hello,
I have created a batch with a method that returns a json in a specific format (key-value pair)
It looks like that I should use something like that:
Could someone help?
Thanks
I have created a batch with a method that returns a json in a specific format (key-value pair)
private String prettyPrintLayoutFields(Map<String,String> layoutFieldMap){ String result; result = layoutFieldMap.toString(); System.debug('String result ' +result); return result; }The value parsed into the field looks like this:
{Performance_Level__c=Performance Level, CreatedById=Created By, CreatedDate=Created By, LastModifiedById=Last Modified By, LastModifiedDate=Last Modified By, Name=Sub-Step Name, Level_of_details__c=Level of details, OwnerId=Owner, RecordTypeId=Record Type, ...}How can I update this method to only print the key separated by a comma.
It looks like that I should use something like that:
string.join(map.keyset(),',');But not quite on how to write it in my method
Could someone help?
Thanks
Please try the below code :
Thanks,
Maharajan.C