MCPcopy Index your code
hub / github.com/AI45Lab/Code / py_to_json_value

Function py_to_json_value

sdk/python/src/lib.rs:3464–3467  ·  view source on GitHub ↗

Convert an arbitrary Python value into a `serde_json::Value`.

(py: Python<'_>, obj: &Bound<'_, PyAny>)

Source from the content-addressed store, hash-verified

3462
3463/// Convert an arbitrary Python value into a `serde_json::Value`.
3464fn py_to_json_value(py: Python<'_>, obj: &Bound<'_, PyAny>) -> PyResult<serde_json::Value> {
3465 serde_json::from_str(&py_dumps(py, obj)?)
3466 .map_err(|e| PyValueError::new_err(format!("invalid JSON: {e}")))
3467}
3468
3469/// Convert a `StepOutcome` into a Python dict.
3470fn step_outcome_to_py(py: Python<'_>, outcome: &RustStepOutcome) -> PyResult<PyObject> {

Callers 1

pipelineMethod · 0.85

Calls 1

py_dumpsFunction · 0.85

Tested by

no test coverage detected