Created
          October 2, 2019 10:09 
        
      - 
      
- 
        Save olopsman/4bab5d82a22bc43cbaa57406865f6600 to your computer and use it in GitHub Desktop. 
    Apex JSONdeserialize to a GetPerson class from array
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | String input = '[{"name":"paulo","age":42, "car" : {"model" : "outlander", "year" : "2016"}}, {"name":"tin","age":40, "car" : {"model" : "crv", "year" : "2004"}}]'; | |
| List<GetPerson> person = (List<GetPerson>) JSON.deserialize(input, List<GetPerson>.class); | |
| system.assertEquals(person.size(), 2); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment