1.JSONGenerator :
Use this for manual control over JSON creation.
Perfect for building custom or dynamic JSON structures.
1.Need complete control over JSON Structure.
2.Add custom fields,logic or error handling.
2.JSON.serialize()
Quickly convert known objects or collections to JSON.
e.g. Sending records to external system.
3.JSON.deserialize()
Automatically map JSON into salesforce objects.
e.g. receiving data from APIs
4.JSON.deserializeUntyped()
Handle dynamic or unknown JSON structures by converting them into Apex Maps and Lists.
1.Unknown or dynamic JSON schemas.
2.JSON with extra or nested fields not directly tied to Salesforce objects.
5.JSONParser
Handle dynamic or unknown JSON structures by converting them into Apex Maps and Lists.
1.Need granular control over JSON parsing.
2.Working with complex or deeply nested JSON.
JSONGenerator : Custom JSON creation with full control
JSON.serialize() : Converting objects into JSON quickly, when structure matches the object.
JSON.deserialize() : Converting JSON to salesforce objects easily
JSON.deserializeUntyped() : Dynamic JSON structures with unknown fields or nested data
JSONParser : Fine-grained control for parsing JSON token by token.
No comments:
Post a Comment