You need to sign in to do that
Don't have an account?
S S Malik
System.JSONException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]
Hi Developers
I am facing this error
Please help me to solve this problem and my code are
Class# consolewrap
public class consolewrap {
public String class_id{get;set;}
public String class_time{get;set;}
public String tutor_id{get;set;}
public String tutor_name{get;set;}
public String tutor_email{get;set;}
public String tutor_phone{get;set;}
}
Class # Calloutcontroller
public class Calloutcontroller {
public List<consolewrap> ConsoleWrapperList{get;set;}
public List<consolewrap> getperformcallout(){
ConsoleWrapperList = new List<consolewrap>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://www.itutorindia.com/angularjs/api/smallWidget/tutorHourSalesForce');
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
ConsoleWrapperList=(List<consolewrap>)json.deserialize(res.getbody(),List<consolewrap>.class);
}
return consolewrapperlist;
}
}
VF PAGE #
<apex:page controller="Calloutcontroller" title="JSON table" >
<apex:form > <apex:pageBlock >
<apex:pageBlockTable value="{!performcallout}" var="wrap">
<apex:column headerValue="class id" value="{!wrap.class_id}"/>
<apex:column headerValue="class time" value="{!wrap.class_time}"/>
<apex:column headerValue="tutor id" value="{!wrap.tutor_id}"/>
<apex:column headerValue="tutor name" value="{!wrap.tutor_name}"/>
<apex:column headerValue="tutor email" value="{!wrap.tutor_email}"/>
<apex:column headerValue="tutor phone" value="{!wrap.tutor_phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I had made the remote site also
I am facing this error
Please help me to solve this problem and my code are
Class# consolewrap
public class consolewrap {
public String class_id{get;set;}
public String class_time{get;set;}
public String tutor_id{get;set;}
public String tutor_name{get;set;}
public String tutor_email{get;set;}
public String tutor_phone{get;set;}
}
Class # Calloutcontroller
public class Calloutcontroller {
public List<consolewrap> ConsoleWrapperList{get;set;}
public List<consolewrap> getperformcallout(){
ConsoleWrapperList = new List<consolewrap>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://www.itutorindia.com/angularjs/api/smallWidget/tutorHourSalesForce');
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
ConsoleWrapperList=(List<consolewrap>)json.deserialize(res.getbody(),List<consolewrap>.class);
}
return consolewrapperlist;
}
}
VF PAGE #
<apex:page controller="Calloutcontroller" title="JSON table" >
<apex:form > <apex:pageBlock >
<apex:pageBlockTable value="{!performcallout}" var="wrap">
<apex:column headerValue="class id" value="{!wrap.class_id}"/>
<apex:column headerValue="class time" value="{!wrap.class_time}"/>
<apex:column headerValue="tutor id" value="{!wrap.tutor_id}"/>
<apex:column headerValue="tutor name" value="{!wrap.tutor_name}"/>
<apex:column headerValue="tutor email" value="{!wrap.tutor_email}"/>
<apex:column headerValue="tutor phone" value="{!wrap.tutor_phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I had made the remote site also
public Calloutcontroller(ApexPages.StandardController controller) {
}
public List<consolewrap> ConsoleWrapperList{get;set;}
public List<consolewrap> getperformcallout(){
ConsoleWrapperList = new List<consolewrap>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://www.itutorindia.com/angularjs/api/smallWidget/tutorHourSalesForce');
req.setMethod('GET');
req.setHeader('Content-Type', 'application/json');
req.setHeader('Accept','application/json');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
system.debug('Response body result is+++: ' + res.getBody());
ConsoleWrapperList=(List<consolewrap>)json.deserialize(res.getbody(),List<consolewrap>.class);
}
return ConsoleWrapperList;
}
}
All Answers
Please refer below link for a similar issue.
http://salesforce.stackexchange.com/questions/48755/getting-error-while-deserialize
If this helps you please mark it as solved.
Thanks and Regards
Sandhya
Thanks for respond Sandhya
public Calloutcontroller(ApexPages.StandardController controller) {
}
public List<consolewrap> ConsoleWrapperList{get;set;}
public List<consolewrap> getperformcallout(){
ConsoleWrapperList = new List<consolewrap>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://www.itutorindia.com/angularjs/api/smallWidget/tutorHourSalesForce');
req.setMethod('GET');
req.setHeader('Content-Type', 'application/json');
req.setHeader('Accept','application/json');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
system.debug('Response body result is+++: ' + res.getBody());
ConsoleWrapperList=(List<consolewrap>)json.deserialize(res.getbody(),List<consolewrap>.class);
}
return ConsoleWrapperList;
}
}