Replace hacky target stringification with structured serialization.