Calling toJSON on fields only if the fn exists