fix toJson method