added toJson method