+ Start a Discussion
vijaymindvijaymind 

System.JSONException: Premature end of Apex Object at [line:, column:]

Hi Folks ,

I have badly stuck while deserialize JSON in to Apex Wrapper Class .

I have successfully deserialized lot of JSON string in to apex but now this error raising .

 

Can anyone see this error ever , please help me out , I know this is silly mistake but really I am not able to identify the problem. 
Let me know if you need JSON string and Apex class code ? 

 

 

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
vijaymindvijaymind

Hi ,

I got the solution there some Node returning the null values and I was treating them as string , even there could be a array or list of string to create a different class .

 

All Answers

vijaymindvijaymind

Hi ,

I got the solution there some Node returning the null values and I was treating them as string , even there could be a array or list of string to create a different class .

 

This was selected as the best answer
aj112aj112

Hi VIJAY,

 

I am also getting the same error and some nodes are returning null values. How do I get rid of this error.

 

Thanks,

Amar

vijaymindvijaymind

Hi Amar ,

 

Make sure that you have the complete returning data structure of JSON string , only then you can put the proper string, list in your wrapper class. Some times JSON data return null value in some of the part but dont know that this null value could a list also , so accordingly you have to create aprat class for that list , it may be that you have declared that one as string which is now returning a list .

 

Ryan ShillingtonRyan Shillington

For me, this was happeneing because I was getting:

 

System.JSONException: Premature end of list at [line:1, column:303]

 That's because the class APEX was parsing into was expecting a list, but the JSON being produced was removing the array brackets ([]) for a single result.