Format the change for JSON output.
(
&self,
change: &Change,
hash: &Hash,
sequence: Option<u64>,
ledger: Vec<JsonChangeLedger>,
)
| 366 | |
| 367 | /// Format the change for JSON output. |
| 368 | pub(crate) fn format_json( |
| 369 | &self, |
| 370 | change: &Change, |
| 371 | hash: &Hash, |
| 372 | sequence: Option<u64>, |
| 373 | ledger: Vec<JsonChangeLedger>, |
| 374 | ) -> String { |
| 375 | let json_change = |
| 376 | JsonChange::from_change_with_provenance(change, hash, sequence).with_ledger(ledger); |
| 377 | serde_json::to_string_pretty(&json_change) |
| 378 | .unwrap_or_else(|e| format!("{{\"error\": \"Failed to serialize: {}\"}}", e)) |
| 379 | } |
| 380 | |
| 381 | /// Load the change ledger(s) — the causal decision graph(s) from the |
| 382 | /// `.provenance` file — for JSON output. Mirrors the `Change Ledger` |