pub async fn format_json_file(path: PathBuf) -> Result<()>Expand description
Formats a JSON file by pretty-printing its contents.
This function reads a JSON file, parses it, and writes it back with proper formatting and indentation. The original file is overwritten with the formatted version.
§Arguments
path- Path to the JSON file to format
§Returns
Result<()>- Success or failure of the operation
§Errors
Returns an error if:
- The file cannot be read
- The content cannot be parsed as JSON
- The formatted JSON cannot be written back to the file