Parsing JSON data from Workbench
Why do we always start a question with“why”? The first question that comes to our mind is “Why we are using Workbench for JSON parsing?”
As a Salesforce Consultant I would also follow up similarly with a few other questions such as “Is it the simplest method of Parsing JSON data?”, and “are there other ways in which we can parse JSON data in workbench”. Over the last 4 years with Girikon in the Salesforce Consulting Services team I will try and answer the questions above through an understanding of the given methods below:
METHOD 1: JSON PARSING THROUGH WORKBENCH VIA SERVER
The JSON file is developed as separate code and therefore the most efficient way to check the dynamic project is through the Workbench JSON data parsing method which will benefit the developer by bypassing the rest of the code meaning there is no chance of changing existing code and messing it up. Using Workbench JSON data parsing method also provides the additional benefits such as time saving which translates to increased efficiencies, less complexity and reduced vulnerability to the written code.
Follow the below steps for using Rest Method through workbench:
1. Before you start it is important to set up an account in Workbench.
https://workbench.developerforce.com/login.php?startUrl=%2Fquery.php.At this point login with your Salesforce account.
2. Go to Utilities -> and select Rest Explorer
3. Select the Http Method as POST.
4. Create an Apex class, for mapping the data to be Posted.
5. Set the URL according to Mapping URL and Method
6. Provide the JSON Data in Request body.
And, check the content type from headers.
OUTPUT from the Rest Method will be as follows:
and a new account record will be created in Account sObject .
METHOD 2: JSON DATA PARSING THROUGH WORKBENCH TO SOBJECTS
1. Go to workbench -> Rest Explorer -> HTTP Method POST
2. Now, set the path of the sObject you want as we have used sObject Account to Parse the JSON data.
3. Provide the JSON Data in Request body.
This will create an account sObject in your Org.
and a new account record will be created in Account sObject.
Girikon is a Salesforce consulting company,based out of Phoenix, Arizona with development centre in Noida, India and offices in Melbourne, Australia. Girikon’s global network of offices in USA, India and Australia, allows Girikon to quickly respond to customer’s requirements with a view to effectively delivering a quality product and service. Girikon has a team of experienced and certified Salesforce Consultants including Architects, Developers, Consultants, and Administrators.
Girikon’s team of dynamic, seasoned and qualified professionals have a vast experience in IT across various business areas, Software/ Product development, design, testing, maintenance and resourcing / staffing options. We believe in developing scalable & simplified solution for our clients.