fix: string json response error

This commit is contained in:
Pooja Belaramani 2024-12-18 15:01:06 +05:30
parent b9ec0acab4
commit aea25842ce

View File

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