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 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
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')); | |
} |
Sick thank you
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
After many hours of trying to figure out how to accomplish this..... I found this solution! Thanks a lot