Skip to content

Instantly share code, notes, and snippets.

@tehnrd
Last active March 1, 2023 07:27
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tehnrd/4559623 to your computer and use it in GitHub Desktop.
Save tehnrd/4559623 to your computer and use it in GitHub Desktop.
Getting values out of a JSON list of objects with Apex code.
List<Object> fieldList = (List<Object>)JSON.deserializeUntyped('[{"field":"phone","object":"account"},{"field":"name","object":"account"}]');
for(Object fld : fieldList){
Map<String,Object> data = (Map<String,Object>)fld;
//Magic!
system.debug(data.get('field'));
}
@jorgelopez200
Copy link

After many hours of trying to figure out how to accomplish this..... I found this solution! Thanks a lot

@maxbisesi
Copy link

Sick thank you

@kennethkim1221
Copy link

kennethkim1221 commented Mar 1, 2023

Worked like a charm! I've spent hours trying different solutions until I came upon this one which is so straightforward! Thank a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment