///|
extend Matrix2D with ToJson::{to_json}

///|
extend Path with ToJson::{to_json}

///|
extend Grid with ToJson::{to_json}

///|
extend SvgDocument with ToJson::{to_json}

///|
/// Convert Matrix2D to JSON string
pub fn Matrix2D::to_json_string(self : Matrix2D, indent? : Int) -> String {
  let pi = indent.unwrap_or(0)
  self.to_json().stringify(indent=pi)
}

///|
/// Convert Path to JSON string
pub fn Path::to_json_string(self : Path, indent? : Int) -> String {
  let pi = indent.unwrap_or(0)
  self.to_json().stringify(indent=pi)
}

///|
/// Convert Grid to JSON string
pub fn Grid::to_json_string(self : Grid, indent? : Int) -> String {
  let pi = indent.unwrap_or(0)
  self.to_json().stringify(indent=pi)
}

///|
/// Convert SvgDocument to JSON string
pub fn SvgDocument::to_json_string(self : SvgDocument, indent? : Int) -> String {
  let pi = indent.unwrap_or(0)
  self.to_json().stringify(indent=pi)
}