MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / format_json

Method format_json

atomic-cli/src/commands/change/command.rs:656–667  ·  view source on GitHub ↗

Format the change for JSON output.

(
        &self,
        change: &Change,
        hash: &Hash,
        sequence: Option<u64>,
        ledger: Vec<JsonChangeLedger>,
    )

Source from the content-addressed store, hash-verified

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 ===`

Calls 1

with_ledgerMethod · 0.80