I'm trying to use the System method
JSON.deserialize(jsonString, apexType) to deserialize the body of an ApexRest POST request. My code compiles, but at runtime I'm getting a
System.NullPointerException from the line making the
Here's a snippet of my code.
RestRequest req = RestContext.request; String jsonString = req.requestBody.toString(); System.Type myType = System.Type.forName('PostDataWrapper'); // This next line throws a System.NullPointerException PostDataWrapper postData = (PostDataWrapper)JSON.deserialize(jsonString, myType);
I've confirmed that the
requestBody body has the correct JSON payload, and I'm sure that I have a
PostDataWrapper type because it's declared in the ApexRest class itself as an inner class.
Where is the
System.NullPointerException coming from?