Skip to content

Instantly share code, notes, and snippets.

@olopsman
Created October 2, 2019 09:58
Show Gist options
  • Save olopsman/9d08b392eef7144e1c4eab7f376c0cb1 to your computer and use it in GitHub Desktop.
Save olopsman/9d08b392eef7144e1c4eab7f376c0cb1 to your computer and use it in GitHub Desktop.
Apex JSONdeserializeUntyped
String input = '{"name":"paulo","age":42, "car" : {"model" : "outlander", "year" : "2016"}}';
Map<String, Object> o = (Map<String, Object>) JSON.deserializeUntyped(input);
system.assertEquals(o.get('name'), 'paulo');
system.assertEquals(o.get('age'), 42);
Map<String, Object> car = (Map<String, Object>) o.get('car');
system.assertEquals(car.get('model'), 'outlander');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment