You need to sign in to do that
Don't have an account?
rupesh ranjan
System.JSONException: Unexpected character ('f' (code 102)):
Retrieving Email template from Json..
Getting an error System.JSONException: Unexpected character ('f' (code 102)):
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Controller////////////////////////////////////////////////////////
public class Calloutcontroller1 {
public List<template1> ConsoleWrapperList3{get;set;}
public List<template1> getperformcallout3(){
ConsoleWrapperList3 = new List<template1>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://webapi.demomail.net/test/bodyTemplate.js');
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
String replaceIllegal= res.getbody().replaceAll('\n','').replaceAll('\r','').replaceAll('"e;','').replaceAll('font;','');
ConsoleWrapperList3=(List<template1>)System.JSON.deserialize( res.getbody(),List<template1>.class);
}
return consolewrapperlist3;
}
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\VF Page\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
<apex:page controller="Calloutcontroller1" sidebar="false" docType="html-5.0" >
<apex:form >
<apex:pageBlock id="ThePage">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<messaging:htmlEmailBody >
<html>
<body>
<span>Body</span>
<div>
{!performcallout3}
</div>
</body>
</html>
</messaging:htmlEmailBody>
<!--<apex:outputText value="" style="width:400px ; height:400px"></apex:outputText>-->
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Wrapper Class//////////////////////////////////////////////
public class template1{
public String Id{get;set;}
public String bodyT{get;set;}
}
Getting an error System.JSONException: Unexpected character ('f' (code 102)):
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Controller////////////////////////////////////////////////////////
public class Calloutcontroller1 {
public List<template1> ConsoleWrapperList3{get;set;}
public List<template1> getperformcallout3(){
ConsoleWrapperList3 = new List<template1>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://webapi.demomail.net/test/bodyTemplate.js');
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
String replaceIllegal= res.getbody().replaceAll('\n','').replaceAll('\r','').replaceAll('"e;','').replaceAll('font;','');
ConsoleWrapperList3=(List<template1>)System.JSON.deserialize( res.getbody(),List<template1>.class);
}
return consolewrapperlist3;
}
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\VF Page\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
<apex:page controller="Calloutcontroller1" sidebar="false" docType="html-5.0" >
<apex:form >
<apex:pageBlock id="ThePage">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<messaging:htmlEmailBody >
<html>
<body>
<span>Body</span>
<div>
{!performcallout3}
</div>
</body>
</html>
</messaging:htmlEmailBody>
<!--<apex:outputText value="" style="width:400px ; height:400px"></apex:outputText>-->
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Wrapper Class//////////////////////////////////////////////
public class template1{
public String Id{get;set;}
public String bodyT{get;set;}
}
change the vf page code as below
All Answers
Please use the below code.
This will solve your issue
change the vf page code as below
Json are displaying with HTML tag.. this sholud not be happen
I want without HTML tag
How to get value from one Visual force tab to second Visual force tab???
in the Apexclass create a method and in vf page create a button to call the method
PageReference pg=new Pagereference('/apex/test?id='+'value&name='+'name');
pg.setRedirect(true);
return pg;