+ Start a Discussion
Etienne Gaudry 5Etienne Gaudry 5 

JSON Basic

I try have a wrapper like this (JSON)
public class myWrapper {

public String name;
public cls_status status;

class cls_status {
        public Integer id;	//0
        public String value;	//string
        public String href;	//string
If i want to fill name, i can do
myWrapper resWrap = new myWrapper();
resWrap.name= 'David';

 But how can i fill value of status ? resWrap.status.value doesn't work.

Ty for help :)

Mark Moser 10Mark Moser 10
 public class wrapaccount{         
     public account accn{get;set;}    
    public boolean isSelected{get;set;}              
  public wrapaccount(account a){
                 accn=a;        //assign values this way...
              isselected=false;        }  


 public List<AccountWrapper> listAccountWrapper {get; set;}
 listAccountWrapper = new List<AccountWrapper>();

for(Account a: [select Id, Name,BillingState, Website, Phone ,Active__c from Account limit 10]) {
                 listAccountWrapper.add(new AccountWrapper(a));
Etienne Gaudry 5Etienne Gaudry 5

Thanks Mark but you don't really answer my question. I posted a small extract but my wrapper is large. I have a method (for cal api). I need to access the wrapper in the wrapper, as explained in my first post. How can i populate value,id, and href in my exemple ?