I have created a component which takes users input and when the submit button is hit I want the component to insert my transaction__c records from the created JSONList,

As it stands my example json looks like so for 2 transaction records:


This list is past into the apex controller "insertTransactions" method which I currently have like so:

    public static void insertTransactions(String tListJSON) {
        //insert tListJSON;
        catch(exception e){
            System.debug('error inserting transactions @ ' + e);

I have tried creating a json2apex class but the __c isn't accepted so what are my options here for getting this to insert correctly?


1 Answer 1


You need to use the JSON class in Apex to deserialize it:

JSON.deserialize(tListJSON, List<Transaction__c>.class);
  • Another option is to use a wrapper class as you would be 100% sure on what to expect with serialize/de-serialize
    – Raul
    Nov 6, 2017 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .