Skip to main content
Post Closed as "Duplicate" by glls, battery.cord, Mohith Shrivastava apex
edited tags
Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431
Source Link
xorLogic
  • 155
  • 2
  • 9

How do you perform JSON parsing in Apex scripting?

I obtained some JSON output from a REST response and I want to parse that directly in my Apex script to either run if-tests or determine which JSON key contains information to run further actions. Salesforce doesn't seem to have good documentation here on how to do it, but I've seen references to a JSON2Apex module that can perform some of what I need. How can I learn how to properly parse JSON text responses to run follow-up actions? Is everything done by making calls to nextToken() or getCurrentToken() down the line until you find what you need?