Skip to content

Instantly share code, notes, and snippets.

@olopsman
Created October 2, 2019 10:07
Show Gist options
  • Save olopsman/c26037501537045ff3085c2bc577d80b to your computer and use it in GitHub Desktop.
Save olopsman/c26037501537045ff3085c2bc577d80b to your computer and use it in GitHub Desktop.
Apex JSONdeserialize to a class GetPerson
String input = '{"name":"paulo","age":42, "married":true, "car" : {"model" : "outlander", "year" : "2016"}}';
GetPerson person = (GetPerson) JSON.deserialize(input, GetPerson.class);
system.assertEquals(person.name, 'paulo');
system.assertEquals(person.car.model, 'outlander');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment