edit_json

Function edit_json 

Source
pub fn edit_json(
    json: &mut Value,
    key: &str,
    new_value: Value,
) -> Result<(), Error>
Expand description

Edits a JSON file by updating a specific key with a new value.

§Arguments

  • json - A mutable reference to the JSON object to edit.
  • key - The key in the JSON object to update.
  • new_value - The new value to set for the specified key.

§Returns

  • Result<(), Error> - Returns Ok if successful, or an error if the JSON structure is invalid.