function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

I have been asked how we are parsing a json string. How do I answer that or what does that mean? Im not sure how to figure out what we are doing currently?

Srikanth BanothSrikanth Banoth
When a function is called with json string as input how to you handle/convert the json string to apex type to play with json because you cannot directly run operations on string i suggest read documentation of JSON.serialization and JSON.deserialization
Arun Kumar 1141Arun Kumar 1141
Hi St2018,

Parsing a JSON string means extracting data from a JSON (JavaScript Object Notation) formatted text and converting it into a format that can be used by a programming language or application. JSON is a lightweight data interchange format commonly used for data storage and exchange between a server and a client, or between different parts of a software application.

Here's an example of a JSON string and how to parse it in JavaScript:
// JSON string
var jsonString = '{"name": "John", "age": 30, "city": "New York"}';

// Parse the JSON string into a JavaScript object
var jsonObj = JSON.parse(jsonString);

// Accessing values in the JavaScript object
console.log("Name: " +; // Output: Name: John
console.log("Age: " + jsonObj.age);   // Output: Age: 30
console.log("City: " +; // Output: City: New York

In this example, we have a JSON string representing an object with three key-value pairs: "name," "age," and "city." We use `JSON.parse()` to convert the JSON string into a JavaScript object, and then we can access the values in the object just like we would with any other JavaScript object.

Hope this will be helpful.