only call toJSON on the relation if the method exists