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
prasanth sfdcprasanth sfdc 

rest api json format problem. Please help

I am trying to integrate with Indian postal department data.  I am getting the below error from VF page code.   Please help me to solve this. 

System.JSONException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]
Error is in expression '{!submit}' in component <apex:commandButton> in page postacodeapi: Class.System.JSON.deserialize: line 15, column 1
Class.fromJSON.parse: line 23, column 1
Class.postacodeAPIClass.submit: line 30, column 1


 
//
//Generated by AdminBooster
//

public class fromJSON{
    public String Message;  //Number of Post office(s) found: 11
    public String Status;   //Success
    public cls_PostOffice[] PostOffice;
    class cls_PostOffice {
        public String Name; //Addanki Gate
        public String Description;  //
        public String BranchType;   //Sub Post Office
        public String DeliveryStatus;   //Non-Delivery
        public String Taluk;    //Ongole
        public String Circle;   //Ongole
        public String District; //Prakasam
        public String Division; //Prakasam
        public String Region;   //Vijayawada
        public String State;    //Andhra Pradesh
        public String Country;  //India
    }
    public static fromJSON parse(String json){
        return (fromJSON) System.JSON.deserialize(json, fromJSON.class);
    }

   
}
 
public class postacodeAPIClass {
public string pcode{set;get;}
public string result{set;get;}
public integer scode{set;get;}
public string status{set;get;}
public List<fromJSON> wrapList{set;get;}
public void submit()
{


wrapList = new list<fromJSON>();

http p=new http();
httprequest req=new httprequest();
 req.setendpoint('http://postalpincode.in/api/pincode/'+pcode);
//req.setendpoint('http://facebook.com');
req.setmethod('GET');
httpresponse res=new httpresponse();
res =p.send(req);

result=res.getbody();

 
// result = '[{"Name":"Addanki Gate","Description":"","BranchType":"Sub Post Office","DeliveryStatus":"Non-Delivery","Taluk":"Ongole","Circle":"Ongole","District":"Prakasam","Division":"Prakasam","Region":"Vijayawada","State":"Andhra Pradesh","Country":"India"},{"Name":"Dcp(O)","Description":"","BranchType":"Sub Post Office","DeliveryStatus":"Non-Delivery","Taluk":"Ongole","Circle":"Ongole","District":"Prakasam","Division":"Prakasam","Region":"Vijayawada","State":"Andhra Pradesh","Country":"India"}]';
scode=res.getstatuscode();
status=res.getstatus();

   //  wrapList  = (List<fromJSON>)System.JSON.deserialize(result, list<fromJSON>.class);
  //fromJSON fromJSON2  = (fromJSON)System.JSON.deserialize(result,fromJSON.class);
 fromJSON wrapList = fromJSON.parse(res.getbody());

}

  
      
      
      

}