Files
threshold-ui/ui/desktop/electron-app/src/utils/jsonify.js
T

12 lines
222 B
JavaScript

// Convert to json
const jsonify = (data) => {
if (typeof data !== 'string') data = JSON.stringify(data);
try {
return JSON.parse(data);
} catch (e) {
// Ignore parse errors
}
};
module.exports = jsonify;