use std::{fs::File, io::Read};
use serde_json::Value;
pub fn load_json_file(path: &str) -> Result<Value, String> {
let file = File::open(path);
if file.is_err() {
return Err(format!("failed to open file: {}", file.err().unwrap()));
}
let mut data = String::new();
file.unwrap()
.read_to_string(&mut data)
.map_err(|e| e.to_string())?;
let json_value: Value = serde_json::from_str(&data).map_err(|e| e.to_string())?;
Ok(json_value)
}