fix: condition

This commit is contained in:
Pooja Belaramani 2024-12-23 13:36:58 +05:30
parent 236bc48d98
commit 582e8e5eac

View File

@ -27,11 +27,8 @@ const formatResponse = (data, mode, filter) => {
let isValidJSON = false;
try {
if (typeof data === 'string') {
isValidJSON = true;
} else {
isValidJSON = typeof JSON.parse(JSON.stringify(data)) === 'object';
}
isValidJSON =
typeof JSON.parse(JSON.stringify(data)) === 'object' || typeof JSON.parse(JSON.stringify(data)) === 'string';
} catch (error) {
console.log('Error parsing JSON: ', error.message);
}