pub fn from_json(file: &str, output: Option<&str>) -> Result<(), CliError>Expand description
Convert a JSON file to HEDL format.
Parses a JSON file and converts it to canonical HEDL format.
§Arguments
file- Path to the JSON file to convertoutput- Optional output file path. IfNone, writes to stdout
§Returns
Returns Ok(()) on success.
§Errors
Returns Err if:
- The file cannot be read
- The JSON is malformed
- JSON-to-HEDL conversion fails
- HEDL canonicalization fails
- Output writing fails
§Examples
use hedl_cli::commands::from_json;
// Convert JSON to HEDL on stdout
from_json("data.json", None)?;
// Convert JSON to HEDL file
from_json("data.json", Some("output.hedl"))?;