Skip to main content
[ This file is autogenerated from apexdoc ]

AqJsonToSobjectParser

Parses JSON and creates/updates Salesforce records based on mapping configuration. Handles hierarchical data structures, external ID matching, and field value conversion.

Group modules/mapping tool

Overview​

AqJsonToSobjectParser is responsible for parsing JSON strings and converting them into Salesforce records. It handles:

  • JSON structure validation
  • External ID-based record matching
  • Hierarchical record processing (parent-child relationships)
  • Field value type conversion
  • Update behavior enforcement
  • Lookup field resolution

Usage​

Typically used through AqMappingToolService, but can be instantiated directly for advanced use cases:

AqJsonToSobjectParser parser = new AqJsonToSobjectParser(
jsonString,
'AccountMapping',
true // requireExternalIds
);

List<AqRecordWithChildren> records = parser.upsertParsedSobjects();

Error Handling​

The parser provides comprehensive error messages for common issues:

  • Missing external IDs
  • Duplicate external IDs
  • Parent record not found
  • Invalid field types
  • Empty JSON

See the main module documentation for error handling patterns.

Constructors​

public AqJsonToSobjectParser(String jsonString, String rootObjectSettingName, Boolean requireExternalIds)​

public AqJsonToSobjectParser(String jsonString, String rootObjectSettingName, Boolean requireExternalIds, AqFieldDefinitionMappingData fieldDefinitionData, AqObjectDefinitionMappingData objectDefinitionData)​


Fields​

public SOURCE_JSON_PARSER → String​

public ERROR_MESSAGE_EMPTY_JSON → String​

public ERROR_MESSAGE_INCORRECT_JSON_STRUCTURE → String​

public ERROR_MESSAGE_INCORRECT_OBJECT_DEFINITION → String​

public ERROR_MESSAGE_REQUIRED_EXTERNAL_ID_MISSING → String​

public ERROR_MESSAGE_DUPLICATE_EXTERNAL_ID → String​

public ERROR_MESSAGE_PARENT_RECORD_NOT_FOUND → String​

public ERROR_MESSAGE_ATTEMPT_TO_EDIT_SF_DEFAULT_NON_EDITABLE_FIELD → String​

public ERROR_MESSAGE_WRONG_UPDATE_BEHAVIOUR_VALUE → String​

public ERROR_MESSAGE_FAILED_UPSERT → String​

public WARNING_EMPTY_RECORDS_CREATED → String​


Methods​

public List<AqRecordWithChildren> upsertParsedSobjects()​


Classes​

AqJsonToSobjectParserException​

Inheritance

AqJsonToSobjectParserException