This commit is contained in:
oneao committed 2025-06-18 16:30:01 +08:00
1 parent bcc4722efc
commit f48536774f
403 files changed
+34776

No files matched your search

@@ -0,0 +1,16 @@
export function toJson(obj: any): string {
try {
return JSON.stringify(obj);
} catch (error) {
console.error("JSON 转换失败", error);
return "";
}
}
export function toObject<T>(json: string): T | null {
try {
return JSON.parse(json) as T;
} catch (error) {
console.error("JSON 解析失败", error);
return null;
}
}