Format the change for JSON output.
(
&self,
change: &Change,
hash: &Hash,
sequence: Option<u64>,
ledger: Vec<JsonChangeLedger>,
)
| 654 | |
| 655 | /// Format the change for JSON output. |
| 656 | pub(crate) fn format_json( |
| 657 | &self, |
| 658 | change: &Change, |
| 659 | hash: &Hash, |
| 660 | sequence: Option<u64>, |
| 661 | ledger: Vec<JsonChangeLedger>, |
| 662 | ) -> String { |
| 663 | let json_change = |
| 664 | JsonChange::from_change_with_provenance(change, hash, sequence).with_ledger(ledger); |
| 665 | serde_json::to_string_pretty(&json_change) |
| 666 | .unwrap_or_else(|e| format!("{{\"error\": \"Failed to serialize: {}\"}}", e)) |
| 667 | } |
| 668 | |
| 669 | /// Load the change ledger(s) — the causal decision graph(s) from the |
| 670 | /// `.provenance` file — for JSON output. Mirrors the `=== Change Ledger ===` |