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
Tanner RussellTanner Russell 

Issue trying to Deserialize json

I am deserializing json using List<Object> eqt = (List<Object>) JSON.deserializeUntyped(response.getBody()); the issue is that this will work and run if I run it anomonously but if I run it in a test I get System.TypeException: Invalid conversion from runtime type Map<String,ANY> to List<ANY>.
But If I switch it to the map the test code will say there are no exception but the code does not run giving me the opposite exception cannot convert list to map ... 
Ashish KeshariAshish Keshari
Hi Tanner,
I guess you are aware that in Test Classes the actual Apex Callouts does not work and hence you have to create mock classes which will contain mocked version of responses you want. Please confirm so that I can help you further. thanks.