Method for getting list as JSON object.