MCPcopy Create free account
hub / github.com/Tong89/smartNode / from_json

Method from_json

backend/scenario.py:218–226  ·  view source on GitHub ↗

从 JSON 字符串反序列化场景字典。

(text: str)

Source from the content-addressed store, hash-verified

216
217 @staticmethod
218 def from_json(text: str) -> Dict[str, Any]:
219 """从 JSON 字符串反序列化场景字典。"""
220 try:
221 obj = json.loads(text)
222 except json.JSONDecodeError as exc:
223 raise ValueError(f"JSON 解析失败: {exc}") from exc
224 if not isinstance(obj, dict):
225 raise ValueError("JSON 根对象必须为 object")
226 return obj
227
228 @staticmethod
229 def to_yaml(data: Dict[str, Any]) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected