Hi all i'm trying to retrive data from a source which gives me a json with all of a certain property listing details such as bedrooms bathrooms etc...

so I'm trying to parse the data using a wrapper class to then display in a visualforce page...

here is my controller:

public class DomainAPI {
    public List<DomainWrapperClass> ListingWrapperList{get;set;}
    public List<DomainWrapperClass> getperformcallout(){
        ListingWrapperList = new List<DomainWrapperClass>();
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();

        res = http.send(req);
        if(res.getstatusCode() == 200 && res.getbody() != null){
            ListingWrapperList = (List<DomainWrapperClass>)json.deserialize(
        return ListingWrapperList;

Here is my Wrapper Class from Json to Apex using the response body.

public class DomainWrapperClass {
    public class PriceDetails {
        public Integer priceFrom;
        public Integer priceTo;
        public String gstOption;
        public String priceUnit;
        public Boolean canDisplayPrice;
        public String displayPrice;

    public String dateUpdated;
    public GeoLocation geoLocation;
    public String objective;
    public String status;
    public String saleMode;
    public String channel;
    public Integer id;
    public AddressParts addressParts;
    public AdvertiserIdentifiers advertiserIdentifiers;
    public ApmIdentifiers apmIdentifiers;
    public Integer bathrooms;
    public Integer bedrooms;
    public String buildingArea;
    public Integer buildingAreaSqm;
    public Integer carspaces;
    public String dateCreated;
    public String dateMinorUpdated;
    public String dateListed;
    public String description;
    public String headline;
    public Boolean isNewDevelopment;
    public PriceDetails priceDetails;
    public List<String> propertyTypes;
    public ProviderDetails providerDetails;
    public SaleDetails saleDetails;
    public Boolean isWithdrawn;
    public String seoUrl;
    public Boolean homepassEnabled;

    public class ApmIdentifiers {
        public Integer addressId;
        public Integer streetId;
        public Integer suburbId;
        public Integer cadastreId;
        public Integer postcodeId;
        public Integer stateId;
        public String state;
        public Integer propertyTypeId;
        public Integer propertyTypeCategoryId;
        public String streetNumber;

    public class AuctionSchedule {
        public String locationDescription;
        public String openingDateTime;

    public class TenantDetails {

    public class AdvertiserIdentifiers {
        public String advertiserType;
        public Integer advertiserId;
        public List<Integer> contactIds;
        public List<String> agentIds;

    public class ProviderDetails {
        public String providerSystem;
        public String providerAdID;

    public class GeoLocation {
        public Double latitude;
        public Double longitude;

    public class AuctionDetails {
        public AuctionSchedule auctionSchedule;

    public class SaleDetails {
        public String saleMethod;
        public AuctionDetails auctionDetails;
        public TenantDetails tenantDetails;

    public class AddressParts {
        public String streetNumber;
        public String postcode;
        public String street;
        public String suburb;
        public String stateAbbreviation;
        public String displayType;
        public String displayAddress;

Now when I try and run it I'm getting

Non static method cannot be referenced from a static context: List<DomainWrapperClass> DomainAPI.getperformcallout()

any pointers on this would be fantastic.

2 Answers 2


Whatever is calling getPerformCallout is marked as static. You need to make getPerformCallout static as well.


The code calling this method needs to construct an instance of the Domain API class:

new DomainAPI().getperformcallout();
  • Brilliant Thank you its sending now... I am getting a ' Malformed JSON: Expected '[' at the beginning of List/Set' but i guess thats something to do with the wrapper? Commented May 1, 2022 at 2:21
  • @MikeCuming It sounds like you have an object, not a list. Can you share some JSON?
    – sfdcfox
    Commented May 1, 2022 at 4:34
  • { "dateUpdated": "2022-04-29T08:10:33.783Z", "geoLocation": { "latitude": -36.7822038, "longitude": 144.243423 }, "objective": "sale", "status": "new", "saleMode": "buy", "channel": "residential", "id": 2017755924, "addressParts": { "streetNumber": "55", "postcode": "3550", "street": "Nankoor street", "suburb": "Bendigo", "stateAbbreviation": "vic", "displayType": "fullAddress", "displayAddress": "55 Nankoor street, Bendigo VIC 3550" }, Commented May 1, 2022 at 7:05
  • @MikeCuming Yeah, that's apparently an object. Try changing your code to not use a List.
    – sfdcfox
    Commented May 1, 2022 at 12:09
  • Hey man really appreciate the help Commented May 2, 2022 at 7:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .