Fix data format convert problem for PostgreSQL graph storage

This commit is contained in:
yangdx
2025-04-04 04:45:59 +08:00
parent 9c81963908
commit 11d7ef4a87

View File

@@ -1100,11 +1100,14 @@ class PGGraphStorage(BaseGraphStorage):
elif dtype == "edge":
d[k] = json.loads(v)
else:
d[k] = (
json.loads(v)
if isinstance(v, str) and ("{" in v or "[" in v)
else v
)
try:
d[k] = (
json.loads(v)
if isinstance(v, str) and (v.startswith("{") or v.startswith("["))
else v
)
except json.JSONDecodeError:
d[k] = v
return d