Convert an arbitrary Python value into a `serde_json::Value`.
(py: Python<'_>, obj: &Bound<'_, PyAny>)
| 3462 | |
| 3463 | /// Convert an arbitrary Python value into a `serde_json::Value`. |
| 3464 | fn 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. |
| 3470 | fn step_outcome_to_py(py: Python<'_>, outcome: &RustStepOutcome) -> PyResult<PyObject> { |