File size: 255 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
/**
* Attempts to parse a string as JSON
* @param {?string} input possible JSON string
* @returns {*} parsed data or null on failure
*/
export const parseJson = ( input ) => {
try {
return JSON.parse( input );
} catch ( e ) {
return null;
}
};
|