Stringify data into formatted json
(&self)
| 168 | |
| 169 | /// Stringify data into formatted json |
| 170 | pub fn to_json(&self) -> String { |
| 171 | let mut output = HashMap::<&str, Value>::new(); |
| 172 | output.insert("context", serde_json::to_value(&self.context).unwrap()); |
| 173 | output.insert("queries", serde_json::to_value(&self.queries).unwrap()); |
| 174 | serde_json::to_string_pretty(&output).unwrap() |
| 175 | } |
| 176 | |
| 177 | /// Write data as json into output path if it exists. |
| 178 | pub fn maybe_write_json(&self, maybe_path: Option<impl AsRef<Path>>) -> Result<()> { |
no test coverage detected