aipack 0.7.7-WIP

Command Agent runner to accelerate production coding with genai.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Crate utility for toml
//!
//! Note: The goal is that all get serialized to serded_json as this is the cannonical format for now.

use crate::Result;

use serde_json::Value as JsonValue;
use toml::Value as TomlValue;

pub fn parse_toml(toml_content: &str) -> Result<JsonValue> {
	// Parse the TOML string into a TOML value
	let toml_value: TomlValue = toml::from_str(toml_content)?;

	// Convert the TOML value to a serde_json::Value
	let json_value = serde_json::to_value(toml_value)?;

	Ok(json_value)
}