function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Laxmi jeevanLaxmi jeevan 

How to Parse the Data by using Map into different objects

 String response=httpResp .getBody();
                System.debug('*** response is '+response);
            Map<String,object> deserializedMap = (Map<String,object>)JSON.deserializeUntyped(response);
                System.debug('deserializedMap value is::::'+deserializedMap);
​                 Map<string,Object> responseObj = (Map<string,Object>)deserializedMap.get('response');
Hi Here I'm able to getting Response(total key& Value)& I spilted into Key, Based on Key how  to get the vaues in List .
 
Best Answer chosen by Laxmi jeevan
pconpcon
It would be useful if you could provide an example of the data you are trying to access.  For example you can make a ResultClass (like in the code below) and use that.
 
class ResultClass {
    public String FakeResult;
}

List<ResultClass> results = new List<ResultClass>();

String j = '{\"Result\": [{\"FakeResult\" : \"NothingToSeeHere\"},{\"FakeResult\" : \"NothingToSeeHere\"}],\"Status\":\"OK\"}';

Map<String, Object> tmpResult = (Map<String, Object>) JSON.deserializeUntyped(j);

List<Object> resultList = (List<Object>)(tmpResult.get('Result'));

for (Object entry : resultList) {
    results.add((ResultClass)(JSON.deserialize(JSON.serialize(entry), ResultClass.class)));
}
System.debug(results.get(0).FakeResult);

If this code does not help you, please provide the JSON data you are getting back (or at least an example of it) and I can help you.

NOTE: Please use the "Add a code sample" button (icon <>) when adding code to increase readability and make it easier to reference.

All Answers

pconpcon
It would be useful if you could provide an example of the data you are trying to access.  For example you can make a ResultClass (like in the code below) and use that.
 
class ResultClass {
    public String FakeResult;
}

List<ResultClass> results = new List<ResultClass>();

String j = '{\"Result\": [{\"FakeResult\" : \"NothingToSeeHere\"},{\"FakeResult\" : \"NothingToSeeHere\"}],\"Status\":\"OK\"}';

Map<String, Object> tmpResult = (Map<String, Object>) JSON.deserializeUntyped(j);

List<Object> resultList = (List<Object>)(tmpResult.get('Result'));

for (Object entry : resultList) {
    results.add((ResultClass)(JSON.deserialize(JSON.serialize(entry), ResultClass.class)));
}
System.debug(results.get(0).FakeResult);

If this code does not help you, please provide the JSON data you are getting back (or at least an example of it) and I can help you.

NOTE: Please use the "Add a code sample" button (icon <>) when adding code to increase readability and make it easier to reference.
This was selected as the best answer
Laxmi jeevanLaxmi jeevan
Hi Con,

Thank you your reply, I will send my json data.Actually my requirement is i insert json data in salesforce in different objects,here opportunity is parent object and some child objectsdata coming from external system.can you give briefly eplanation.

​{
   "OpportunitySearch":[
      {
         "Services":[

         ],
         "Competitors":[

         ],
         "Alumni":[

         ],
         "PursuitTeamMembers":[
            {
               "IsDeleted":null,
               "BusinessEntityID":2890510,
               "PursuitTeamID":2890510,
               "PersonnelNbr":"00338306",
               "OpportunityNumber":null,
               "ClientName":null,
               "Name":"Hofstee, Kevin (US - Los Angeles)",
               "Email":"khofstee@deloitte.com",
               "PursuitTeamRoleCode":"Z0000085",
               "PursuitTeamRoleDesc":"Pursuit Leader",
               "IsReadOnly":false,
               "IsDirty":false,
               "CreatedByApplication":null,
               "ModifiedByApplication":null
            },
            {
               "IsDeleted":null,
               "BusinessEntityID":2890511,
               "PursuitTeamID":2890511,
               "PersonnelNbr":"00338306",
               "OpportunityNumber":null,
               "ClientName":null,
               "Name":"Hofstee, Kevin (US - Los Angeles)",
               "Email":"khofstee@deloitte.com",
               "PursuitTeamRoleCode":"Z0000135",
               "PursuitTeamRoleDesc":"Entered By",
               "IsReadOnly":false,
               "IsDirty":false,
               "CreatedByApplication":null,
               "ModifiedByApplication":null
            },
            {
               "IsDeleted":null,
               "BusinessEntityID":2890512,
               "PursuitTeamID":2890512,
               "PersonnelNbr":"00125680",
               "OpportunityNumber":null,
               "ClientName":null,
               "Name":"Bonner-Witt, Katrina (US - Miami)",
               "Email":null,
               "PursuitTeamRoleCode":"Z0000139",
               "PursuitTeamRoleDesc":"FSS Lead - Consulting",
               "IsReadOnly":true,
               "IsDirty":false,
               "CreatedByApplication":null,
               "ModifiedByApplication":null
            },
            {
               "IsDeleted":null,
               "BusinessEntityID":2890513,
               "PursuitTeamID":2890513,
               "PersonnelNbr":"00338306",
               "OpportunityNumber":null,
               "ClientName":null,
               "Name":"Hofstee, Kevin (US - Los Angeles)",
               "Email":"khofstee@deloitte.com",
               "PursuitTeamRoleCode":"Z0000139",
               "PursuitTeamRoleDesc":"FSS Lead - Consulting",
               "IsReadOnly":true,
               "IsDirty":false,
               "CreatedByApplication":null,
               "ModifiedByApplication":null
            },
            {
               "IsDeleted":null,
               "BusinessEntityID":2890514,
               "PursuitTeamID":2890514,
               "PersonnelNbr":"00364032",
               "OpportunityNumber":null,
               "ClientName":null,
               "Name":"Stillings, Suzanne (US - Houston)",
               "Email":null,
               "PursuitTeamRoleCode":"Z0000139",
               "PursuitTeamRoleDesc":"FSS Lead - Consulting",
               "IsReadOnly":true,
               "IsDirty":false,
               "CreatedByApplication":null,
               "ModifiedByApplication":null
            }
         ],
         "IsReproposal":null,
         "IsRecurringOpportunity":null,
         "IsSMBDInvlolved":null,
         "IsConfidential":false,
         "IsLinkedOpportunity":false,
         "IsPullThroughOpportunity":null,
         "IsDeloitteSolutionCenter":null,
         "IsThereRFP":false,
         "IsNewOpportunity":true,
         "PursuitStartDate":"2015-07-22T00:00:00",
         "ExpectedPursuitCloseDate":"2017-01-01T00:00:00",
         "ProjectStartDate":null,
         "ProjectEndDate":null,
         "OppActualCloseDate":null,
         "RFPReleaseDate":null,
         "RiskAssessmentComplianceStatus":null,
         "RiskAssessmentScore":null,
         "RiskAssessmentDate":null,
         "RiskConsultationDate":null,
         "RiskReviewDate":null,
         "UserAlias":null,
         "DelegateAlias":null,
         "LastModifiedOn":"2015-10-28T18:01:37.61",
         "InitiativeCode":188,
         "SICCode":0,
         "LawFirmCode":null,
         "PrivateEquityCode":null,
         "InhouseCounselCode":null,
         "TypeOfRecurringWork":null,
         "DSCId":null,
         "PullThroughOriginalOppID":null,
         "OriginalOpportunityID":0,
         "ConsultingFunctionCount":3,
         "Client":null,
         "ModifiedOnRTrak":null,
         "CreatedOnRTrak":"2015-07-22T17:43:58.85",
         "ModifiedByRTrak":"Hofstee, Kevin (US - Los Angeles)",
         "CreatedByRTrak":"Hofstee, Kevin (US - Los Angeles)",
         "Region":null,
         "FiscalYear":null,
         "IntegratedMarketOfferingCodeID":null,
         "IntegratedMarketOfferingCodeDesc":null,
         "PhaseReasonDescription":null,
         "_modifiedByApplication":null,
         "BusinessEntityID":10346444,
         "OpportunityID":10346444,
         "OpportunityName":"Dev: Test Siemens Opportunity 2",
         "OpportunityDescription":"",
         "CanUserViewThisOpportunity":0,
         "ClientID":"0001014861",
         "ClientName":"SIEMENS CORPORATION",
         "CanUserViewClient":0,
         "ParentClientID":"8000008106",
         "ParentClientName":"SIEMENS CORPORATION",
         "CanUserViewParentClient":0,
         "LCSPName":"Pleasance, David (US - Atlanta)",
         "LCSPEmail":"dpleasance@DELOITTE.com",
         "PursuitLeaderID":"00338306",
         "PursuitLeaderName":"Hofstee, Kevin (US - Los Angeles)",
         "PursuitLeaderEmail":"khofstee@deloitte.com",
         "AttestFlag":false,
         "DPSClientGroup":null,
         "ConsultingSectorOfferingCodeID":"0010",
         "ConsultingSectorOfferingCodeDesc":"Not Applicable",
         "LawFirmDescription":null,
         "PrivateEquityDescription":null,
         "InhouseCounselDescription":null,
         "TotalValue":8000000.00,
         "TotalPotentialNetServiceRevenue":0.00,
         "GrossRevenue":null,
         "FeeTypeCode":null,
         "FeeTypeDescription":null,
         "PhaseCode":"Z03",
         "PhaseDescription":"Qualified",
         "PhaseReasonCode":null,
         "ProbabilityOfSuccess":10,
         "InitiativeDescription":"ADV-COMP SYS VDATE",
         "PriorityCode":"4",
         "PriorityDescription":"Low",
         "IntegratedServiceOfferingCode":"NA",
         "IntegratedServiceOfferingDescription":" NA",
         "VBBCaseCode":null,
         "VBBCaseDescription":null,
         "Optional1":null,
         "Optional2":null,
         "Optional3":null,
         "Optional4":null,
         "Optional5":null,
         "PhaseRank":40,
         "IsDirty":true,
         "OriginalOpportunityName":null,
         "CanViewEditOriginalOpportunity":0,
         "QualityReviewValue":"0",
         "QualityReviewComment":"",
         "QualityReviewerName":null,
         "AreThereCompetitors":0,
         "AreThereAlumni":0,
         "TypeOfRecurringWorkDesc":null,
         "PullThroughOriginalOppName":null,
         "CanViewEditPullThroughOriginalOpportunity":0,
         "BuyerName":null,
         "BuyerRoleCode":null,
         "BuyerRoleDescription":null,
         "EngagementIndustry":null,
         "DSCName":null,
         "ReasonCodeDesc":null,
         "CreatedByApplication":null,
         "ModifiedByApplication":null
      }
   ]
}



 
pconpcon
Since you are not using standard sObject field names in your JSON data, the best solution is for you to deserialize this into a custom object
 
public class Services {
    // Fields go here
}

public class Competitors {
    // Fields go here
}

public class Alumni {
    // Fields go here
}

public class PursuitTeamMembers {
    public Boolean isDeleted;
    public Integer businessEntityID;
    // More fields
}

public class OpporutnitySearch {
    public List<Services> services;
    public List<Competitors> competitors;
    public List<Alumni> alumni;
    public List<PursuitTeamMembers> pursuitTeamMembers;
    public String isReproposal;
    public String isRecurringOpportunity;
    // .... More fields go here
    public String createdByApplication;
    public String modifiedByApplication;
}

public class OpportunityWrapper {
    public List<OpportunitySearch> opportunitySearch;
}

Then deserialize into that object
 
OpportunityWrapper wrapper = JSON.deserialize(message, OpportunityWrapper.class);

You could also do some really convoluted typecasting to get all the way down into what you need to get to.
Laxmi jeevanLaxmi jeevan
Hi Con,

What i did  i send to you.can you give the reply
pconpcon
What?
Laxmi jeevanLaxmi jeevan
Hi Con,
This is my class can you modify any changes.



public with sharing class OppsearchTestingCtrl  {
//Variables Declaration

public List<OpportunitySearch > oppList{ get; set;}
public OppsearchTestingCtrl (){ }
 public PageReference submit() {
    
    Http http = new Http();
        HttpRequest httpReq= new HttpRequest();
        HttpResponse httpResp = new HttpResponse(); 
        httpReq.setMethod('POST');
       httpReq.setEndpoint('https://test.testing.com/api/Opportunity/Search');
        String authorizationHeader = 'BASIC testencrptformat=';
       system.debug('authorizationHeader  is '+authorizationHeader );
        httpReq.setHeader('Authorization',authorizationHeader );
       httpReq.setHeader('Content-Length', '0');
       httpReq.setHeader('Content-Type', 'application/json');
       httpReq.setTimeout(120000);
       
        //beliw String is single Record
        String requestBody='{"UserAlias": "test","Modifiedon_RTRAKFrom": "2015-10-28T10:40:00.0805308-10:00","Modifiedon_RTRAKTo": "2015-10-28T11:40:00.0805309-11:00"}';
        httpReq.setBody(requestBody);
         httpResp = http.send(httpReq);
         String response=httpResp .getBody();
               
          Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(response);          
          List<Object> lstCustomers = (List<Object>)results.get('OpportunitySearch');
          Object[] aryCustomers = (Object[]) results.get('OpportunitySearch'); 
          
          for (Object Opptycustomer : lstCustomers) {
     
                 Map<String, Object> customerAttributes = (Map<String, Object>)Opptycustomer;
    
                     for (String attributeName : customerAttributes.keyset()) {
        
         }
     }          
              return null;
        }
 
  public class PursuitTeamMembers {
        public Object IsDeleted;
        public Integer BusinessEntityID;
        public Integer PursuitTeamID;
        public String PersonnelNbr;
        public Object OpportunityNumber;
        public Object ClientName;
        public String Name;
        public String Email;
        public String PursuitTeamRoleCode;
        public String PursuitTeamRoleDesc;
        public Boolean IsReadOnly;
        public Boolean IsDirty;
        public Object CreatedByApplication;
        public Object ModifiedByApplication;
    }

    public class Services {
    }

    public List<OpportunitySearch> OpportunitySearch;

    public class OpportunitySearch {
        public List<Services> Services;
        public List<Services> Competitors;
        public List<Services> Alumni;
        public List<PursuitTeamMembers> PursuitTeamMembers;
        public Object IsReproposal;
        public Object IsRecurringOpportunity;
        public Object IsSMBDInvlolved;
        public Boolean IsConfidential;
        public Boolean IsLinkedOpportunity;
        public Object IsPullThroughOpportunity;
        public Object IsDeloitteSolutionCenter;
        public Boolean IsThereRFP;
        public Boolean IsNewOpportunity;
        public String PursuitStartDate;
        public String ExpectedPursuitCloseDate;
        public Object ProjectStartDate;
        public Object ProjectEndDate;
        public Object OppActualCloseDate;
        public Object RFPReleaseDate;
        public Object RiskAssessmentComplianceStatus;
        public Object RiskAssessmentScore;
        public Object RiskAssessmentDate;
        public Object RiskConsultationDate;
        public Object RiskReviewDate;
        public Object UserAlias;
        public Object DelegateAlias;
        public String LastModifiedOn;
        public Integer InitiativeCode;
        public Integer SICCode;
        public Object LawFirmCode;
        public Object PrivateEquityCode;
        public Object InhouseCounselCode;
        public Object TypeOfRecurringWork;
        public Object DSCId;
        public Object PullThroughOriginalOppID;
        public Integer OriginalOpportunityID;
        public Integer ConsultingFunctionCount;
        public Object Client;
        public Object ModifiedOnRTrak;
        public String CreatedOnRTrak;
        public String ModifiedByRTrak;
        public String CreatedByRTrak;
        public Object Region;
        public Object FiscalYear;
        public Object IntegratedMarketOfferingCodeID;
        public Object IntegratedMarketOfferingCodeDesc;
        public Object PhaseReasonDescription;
        public Object modifiedByApplication;
        public Integer BusinessEntityID;
        public Integer OpportunityID;
        public String OpportunityName;
        public String OpportunityDescription;
        public Integer CanUserViewThisOpportunity;
        public String ClientID;
        public String ClientName;
        public Integer CanUserViewClient;
        public String ParentClientID;
        public String ParentClientName;
        public Integer CanUserViewParentClient;
        public String LCSPName;
        public String LCSPEmail;
        public String PursuitLeaderID;
        public String PursuitLeaderName;
        public String PursuitLeaderEmail;
        public Boolean AttestFlag;
        public Object DPSClientGroup;
        public String ConsultingSectorOfferingCodeID;
        public String ConsultingSectorOfferingCodeDesc;
        public Object LawFirmDescription;
        public Object PrivateEquityDescription;
        public Object InhouseCounselDescription;
        public Double TotalValue;
        public Double TotalPotentialNetServiceRevenue;
        public Object GrossRevenue;
        public Object FeeTypeCode;
        public Object FeeTypeDescription;
        public String PhaseCode;
        public String PhaseDescription;
        public Object PhaseReasonCode;
        public Integer ProbabilityOfSuccess;
        public String InitiativeDescription;
        public String PriorityCode;
        public String PriorityDescription;
        public String IntegratedServiceOfferingCode;
        public String IntegratedServiceOfferingDescription;
        public Object VBBCaseCode;
        public Object VBBCaseDescription;
        public Object Optional1;
        public Object Optional2;
        public Object Optional3;
        public Object Optional4;
        public Object Optional5;
        public Integer PhaseRank;
        public Boolean IsDirty;
        public Object OriginalOpportunityName;
        public Integer CanViewEditOriginalOpportunity;
        public String QualityReviewValue;
        public String QualityReviewComment;
        public String QualityReviewerName;
        public Integer AreThereCompetitors;
        public Integer AreThereAlumni;
        public String TypeOfRecurringWorkDesc;
        public String PullThroughOriginalOppName;
        public Integer CanViewEditPullThroughOriginalOpportunity;
        public String BuyerName;
        public String BuyerRoleCode;
        public String BuyerRoleDescription;
        public String EngagementIndustry;
        public String DSCName;
        public String ReasonCodeDesc;
        public String CreatedByApplication;
        //public String ModifiedByApplication;
    }

   public static OppsearchTestingCtrl  parse(String json) {
        return (OppsearchTestingCtrl  ) System.JSON.deserialize(json, OppsearchTestingCtrl.class);
    }


 
 }
pconpcon
You jut change this section
 
Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(response);
List<Object> lstCustomers = (List<Object>)results.get('OpportunitySearch');
Object[] aryCustomers = (Object[]) results.get('OpportunitySearch'); 
for (Object Opptycustomer : lstCustomers) {
    Map<String, Object> customerAttributes = (Map<String, Object>)Opptycustomer;
    
    for (String attributeName : customerAttributes.keyset()) {
    }
}

to
 
OpportunitySearch oppSearch = JSON.deserialize(response, OpportunitySearch.class);
Laxmi jeevanLaxmi jeevan
Hi Con,

Thank you your reply.

whenn i put below line in my code, i am getting error

OpportunitySearch oppSearch = JSON.deserialize(response, OpportunitySearch.class);


MY Error:
Error: OppsearchTestingCtrl Compile Error: Initial term of field expression must be a concrete SObject: List<OppsearchTestingCtrl.OpportunitySearch>
Laxmi jeevanLaxmi jeevan
Hi Con,

I changed single to List this one also i am getting error.i called below line.

 List<OpportunitySearch > oppList = (List<OpportunitySearch >) JSON.deserialize(response, List<OpportunitySearch >.class); 


My Error:

Visualforce ErrorHelp for this Page

System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set
Error is in expression '{!submit}' in component <apex:commandButton> in page oppsearchtesting: (System Code)
Class.OppsearchTestingCtrl.submit: line 54, column 1

line no 54 means :  List<OpportunitySearch > oppList = (List<OpportunitySearch >) JSON.deserialize(response, List<OpportunitySearch >.class); 
 
pconpcon
If you add http://paste.deadlypenguin.com to your remote site settings you can put the following code in your controller
 
public class OppsearchTestingCtrl {
	public OpportunitySearchWrapper oppSearchWrapper {
		get;
		set;
	}

	public class PursuitTeamMembers {
		public Object IsDeleted;
		public Integer BusinessEntityID;
		public Integer PursuitTeamID;
		public String PersonnelNbr;
		public Object OpportunityNumber;
		public Object ClientName;
		public String Name;
		public String Email;
		public String PursuitTeamRoleCode;
		public String PursuitTeamRoleDesc;
		public Boolean IsReadOnly;
		public Boolean IsDirty;
		public Object CreatedByApplication;
		public Object ModifiedByApplication;
	}

	public class Services {}

	public class OpportunitySearch {
		public List<Services> Services;
		public List<Services> Competitors;
		public List<Services> Alumni;
		public List<PursuitTeamMembers> PursuitTeamMembers;
		public Object IsReproposal;
		public Object IsRecurringOpportunity;
		public Object IsSMBDInvlolved;
		public Boolean IsConfidential;
		public Boolean IsLinkedOpportunity;
		public Object IsPullThroughOpportunity;
		public Object IsDeloitteSolutionCenter;
		public Boolean IsThereRFP;
		public Boolean IsNewOpportunity;
		public String PursuitStartDate;
		public String ExpectedPursuitCloseDate;
		public Object ProjectStartDate;
		public Object ProjectEndDate;
		public Object OppActualCloseDate;
		public Object RFPReleaseDate;
		public Object RiskAssessmentComplianceStatus;
		public Object RiskAssessmentScore;
		public Object RiskAssessmentDate;
		public Object RiskConsultationDate;
		public Object RiskReviewDate;
		public Object UserAlias;
		public Object DelegateAlias;
		public String LastModifiedOn;
		public Integer InitiativeCode;
		public Integer SICCode;
		public Object LawFirmCode;
		public Object PrivateEquityCode;
		public Object InhouseCounselCode;
		public Object TypeOfRecurringWork;
		public Object DSCId;
		public Object PullThroughOriginalOppID;
		public Integer OriginalOpportunityID;
		public Integer ConsultingFunctionCount;
		public Object Client;
		public Object ModifiedOnRTrak;
		public String CreatedOnRTrak;
		public String ModifiedByRTrak;
		public String CreatedByRTrak;
		public Object Region;
		public Object FiscalYear;
		public Object IntegratedMarketOfferingCodeID;
		public Object IntegratedMarketOfferingCodeDesc;
		public Object PhaseReasonDescription;
		public Object modifiedByApplication;
		public Integer BusinessEntityID;
		public Integer OpportunityID;
		public String OpportunityName;
		public String OpportunityDescription;
		public Integer CanUserViewThisOpportunity;
		public String ClientID;
		public String ClientName;
		public Integer CanUserViewClient;
		public String ParentClientID;
		public String ParentClientName;
		public Integer CanUserViewParentClient;
		public String LCSPName;
		public String LCSPEmail;
		public String PursuitLeaderID;
		public String PursuitLeaderName;
		public String PursuitLeaderEmail;
		public Boolean AttestFlag;
		public Object DPSClientGroup;
		public String ConsultingSectorOfferingCodeID;
		public String ConsultingSectorOfferingCodeDesc;
		public Object LawFirmDescription;
		public Object PrivateEquityDescription;
		public Object InhouseCounselDescription;
		public Double TotalValue;
		public Double TotalPotentialNetServiceRevenue;
		public Object GrossRevenue;
		public Object FeeTypeCode;
		public Object FeeTypeDescription;
		public String PhaseCode;
		public String PhaseDescription;
		public Object PhaseReasonCode;
		public Integer ProbabilityOfSuccess;
		public String InitiativeDescription;
		public String PriorityCode;
		public String PriorityDescription;
		public String IntegratedServiceOfferingCode;
		public String IntegratedServiceOfferingDescription;
		public Object VBBCaseCode;
		public Object VBBCaseDescription;
		public Object Optional1;
		public Object Optional2;
		public Object Optional3;
		public Object Optional4;
		public Object Optional5;
		public Integer PhaseRank;
		public Boolean IsDirty;
		public Object OriginalOpportunityName;
		public Integer CanViewEditOriginalOpportunity;
		public String QualityReviewValue;
		public String QualityReviewComment;
		public String QualityReviewerName;
		public Integer AreThereCompetitors;
		public Integer AreThereAlumni;
		public String TypeOfRecurringWorkDesc;
		public String PullThroughOriginalOppName;
		public Integer CanViewEditPullThroughOriginalOpportunity;
		public String BuyerName;
		public String BuyerRoleCode;
		public String BuyerRoleDescription;
		public String EngagementIndustry;
		public String DSCName;
		public String ReasonCodeDesc;
		public String CreatedByApplication;
		//public String ModifiedByApplication;
	}

	public class OpportunitySearchWrapper {
		public List<OpportunitySearch> OpportunitySearch;
	}

	public OppsearchTestingCtrl() {}

	public PageReference submit() {
		Http http = new Http();
		HttpRequest httpReq = new HttpRequest();
		httpReq.setMethod('GET');
		httpReq.setEndpoint('http://paste.deadlypenguin.com/pb9oj4o3u/gdt4az/raw');
		httpReq.setHeader('Content-Type', 'application/json');

		HttpResponse httpResp = http.send(httpReq);
		String response = httpResp.getBody();
		this.oppSearchWrapper = (OpportunitySearchWrapper) JSON.deserialize(response, OpportunitySearchWrapper.class);

		return null;
	}
}

then via the developer console run the following
 
OppsearchTestingCtrl ctrl = new OppsearchTestingCtrl();
ctrl.submit();
System.debug(System.LoggingLevel.ERROR, ctrl.oppSearchWrapper.OpportunitySearch.get(0).OpportunityName);

After you confirm that the debug prints out "Dev: Test Siemens Opportunity 2" then you can update the submit method to do the authorization you need to do.