Skip to main content
Hi,

I need to get list of user names and return a string like below

['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth']

Thanks,

Vetri

 
2 answers
  1. Jul 8, 2015, 11:32 AM
    Hello Vetriselvan,

    You can use JSON Class Methods of Apex:

    Please try following Code:

     

    public String getUserNames(){

    List<Stribng> lstuserName = new List<String>(){ 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth' };

    return JSON.serialize(lstuserName);

    }

    If its helps, please mark as best answer so it will help to other who will serve same problem.

    T​hanks! 

     
0/9000