Refactored and improved seeds (#8695)
- Added a new Seeder service to help with custom object seeds - Added RichTextFieldInput to edit a rich text field directly on the table, but deactivated it for now.
This commit is contained in:
13
packages/twenty-front/src/utils/parseJson.ts
Normal file
13
packages/twenty-front/src/utils/parseJson.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { isDefined } from 'twenty-ui';
|
||||
|
||||
export const parseJson = <T>(json: string | undefined | null) => {
|
||||
if (!isDefined(json)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.parse(json) as T;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user