added a toJson method to Grid