Last active
July 11, 2024 17:07
-
-
Save tehnrd/4559623 to your computer and use it in GitHub Desktop.
Getting values out of a JSON list of objects with Apex code.
This file contains 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
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')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worked like a charm! I've spent hours trying different solutions until I came upon this one which is so straightforward! Thank a lot!