Skip to main content

replace_nulls

Function replace_nulls 

Source
pub fn replace_nulls(value: &mut Value, placeholder: &str)
Expand description

Substitutes placeholder for every null in the document.

The alternative to to_toml’s rejection, and so only ever called on the way to TOML — JSON holds a null fine and has nothing to be rescued from. A null cannot be encoded as TOML, leaving only two honest options: fail, or write a value that was in none of the inputs. Which value that is has to be the user’s choice rather than the tool’s — yq and tomlq both drop null keys silently, and both invent a string inside arrays ("" and "None" respectively, for the same input), which is the behaviour this exists to avoid.