Skip to main content

format_json

Function format_json 

Source
pub fn format_json(input: &str) -> Result<String, Error>
Expand description

Formats strict JSON matching Prettier 3.7.4 (tabWidth: 2, printWidth: 80, bracketSpacing: true, LF).

§Arguments

  • &str - Raw JSON source text.

§Returns

  • Result<String, io::Error> - Formatted JSON ending with \n, or an I/O error if invalid JSON.