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
OyeCodeOyeCode 

System.JSONException: Illegal value for primitive

I get this error while parson through this code- can anybody suggest me solution 

 

public class content {
    public String MTType;
    public String MTTitle;
    public List<String> body;
}






// JSON string that contains a Person object.
String JSONContent =
    '{"content":{'+
      '"MTType":"text/html",'+
      '"MTTitle":"Test Builder",'+
      '"body":['+
         '" <div id=\\"section_1\\" class=\\"mt-page-section\\"><span id=\\"Overview\\"></span><h2 class=\\"editable\\">Overview</h2>anslator to import test results into Odyssey Manager and a learning path is automatically created based on the results of the NWEA or state test.&nbsp;</p></div></div>",'+
         '{'+
          '  "@target":"toc",'+
          '  "#text":"<ol style=\\"list-style-type:none; margin-left:0px; padding-left:0px;\\"><li><span>1.</span> <a href=\\"#Overview\\" rel=\\"internal\\">Overview</a></li><li><span>2.</span> <a href=\\"#Building_an_Objective-Based_Test\\" rel=\\"internal\\">Building an Objective-Based Test</a><ol style=\\"list-style-type:none; margin-left:0px; padding-left:15px;\\"><li><span>2.1.</span> <a href=\\"#What_are_Learning_Paths.3F\\" rel=\\"internal\\">What are Learning Paths?</a></li></ol></li></ol>"'+
         '}'+
      ']'+
   '}'+
'}';
JSONParser parser = 
   JSON.createParser(JSONContent);
// Make calls to nextToken() 
// to point to the second
// start object marker.
parser.nextToken();
parser.nextToken();
parser.nextToken();
// Retrieve the Person object
// from the JSON string.
System.Debug('Json Content'+JSONContent);
content obj = 
   (content)parser.readValueAsStrict(content.class);
System.assertNotEquals(
   obj.body, NULL);
//System.Debug(obj.body[0]);
parser.skipChildren();