I have a class called wrapper. I want to serialize a list of this class objects using JSON.serialize. The problem is I don't want to serialize all the properties available in the class. I want to serialize only a few fields which will be selected by the user, The user might select A1,A3,A4 one time, the next time A1,A6. I will have a remote action method which will receive a comma separted list of fields the user selected. This method should return a JSON object with values. Is there a way available to do this?
public class Wrapper {
public String src {get; set;}
public String A1 {get;set}
public String A2 {get;set}
public String A3 {get;set}
public String A4 {get;set}
public String A5 {get;set}
public String A6 {get;set}
.
.
.
}