Skip to main content

JSON Parsing

Explore practical guides and implementation patterns for this topic.

Posts

Lightning Web Components

How to Track IP Geolocation in Salesforce using LWC and Apex Callouts

Tracking user locations based on IP addresses is a frequent requirement for security auditing, fraud detection, and creating localized customer experiences inside Salesforce. While legacy systems relied heavily on Visualforce, modern Salesforce architecture dictates using Lightning Web Components (LWC) backed by an Apex REST callout to fetch and display this geographic data securely. In plain words: An LWC captures the IP address input by the user and passes it to an Apex class. The Apex class sends an HTTP request to an external geolocation API, receives a JSON package containing location details (like city, country, and time zone), parses it, and sends it back to the LWC to be displayed on the screen.
Read article
Topic Apex
Apex Development

Access members using Json Object in Apex Salesforce

When working with APIs and external web services in Salesforce Apex, parsing JSON responses is a daily task. Apex provides two distinct ways to deserialize JSON data into accessible properties: Typed Deserialization using a Wrapper Class and Untyped Deserialization using Maps.
Read article
Apex Development

How to Parse Raw JSON Payloads in Salesforce Apex Custom REST APIs

Exposing custom REST endpoints in Salesforce using the @RestResource annotation allows third-party systems to create, update, or query records in real time. While simple endpoints can map incoming JSON properties directly to method parameters, complex enterprise integrations often send nested JSON structures, line-item arrays, or dynamic payloads that require manual extraction and deserialization. In plain words: When external systems send deeply nested JSON or lists in an HTTP request, Apex method parameters fall short. Instead, you extract the raw JSON body using RestContext.request.requestBody and convert it into a strongly typed Apex wrapper class using JSON.deserialize() .
Read article