in packages-demo/demo-rc-elements/src/rc/input-json-object/index.tsx [34:50]
function parseWithError<T extends object>(value: string, arrayMode: boolean): T {
let o: unknown;
if (value) {
o = JSON.parse(value);
}
if (!o) {
o = arrayMode ? [] : {};
} else if (arrayMode && !_isArray(o)) {
o = [];
} else if (!arrayMode && !_isPlainObject(o)) {
o = {};
}
return o as T;
}