+ Start a Discussion
Victor Nguyen 13Victor Nguyen 13 

Json data

Hello,
I'm using Webhook to retrieve data from a Form provider. Data is in json format. I would like to map the data to each field of Contact and Opportunity in order to create an Opportunity. I want to map the data to these to Maps

Map<String,String> contactMap = new Map<String,String>();
Map<String,String> opportunityMap = new Map<String,String>();
  
From there, I already wrote a class to create an Opportunity. All I need is to map the data to that map.

Does anyone know how to do that, I'm new to Apex and Salesforce?
Thank you in advance.
Kaustubh LabheKaustubh Labhe
Hey, have a read here. https://salesforce.stackexchange.com/questions/27165/how-do-i-parse-a-json-map-into-an-apex-map 
I guess this is exactly what you are looking for. Parsing your json response in a Apex map. )
Raj VakatiRaj Vakati
Refer this link 

https://opfocus.com/json-deserialization-techniques-in-salesforce/

https://www.lopau.com/demystifying-json-parsing-in-apex/

https://gist.github.com/superfell/1287653

https://www.nextview.nl/how-to-serialize-an-apex-object/

https://sf9to5.com/2018/05/10/parse-json-apex/
http://herogtech.com/salesforce-rest-callout-parse-json-apex/