Fix on view filters (#14462)

Fixes https://github.com/twentyhq/twenty/issues/14058
This commit is contained in:
Charles Bochet
2025-09-12 22:45:26 +02:00
committed by GitHub
parent 894e599173
commit 1e97ad48c0
5 changed files with 36 additions and 7 deletions
@@ -1,11 +1,15 @@
import { isDefined } from "@/utils/validation";
export const parseJson = <T>(rawJson: string | boolean | null | number): T | null => {
export const parseJson = <T>(rawJson: string | boolean | null | number | undefined): T | null => {
try {
if (!isDefined(rawJson)) {
return null;
}
if (rawJson === '') {
return null;
}
// This is a hack to handle the case where the value is a scalar value which is part of JSON spec but not implemented before ES2019
return JSON.parse("[" + rawJson + "]")[0];
} catch {