반응형
const isJson = (str: string) => {
try {
const json = JSON.parse(str);
return json && typeof json === 'object';
} catch (e) {
return false;
}
};
반응형
'웹프로그래밍 > Javascript' 카테고리의 다른 글
window.open 새로운 윈도우 창에 post 로 보내기 (0) | 2022.05.31 |
---|---|
get only text by clipboard (0) | 2020.07.08 |
get Image width and height (0) | 2020.07.08 |
moment.js (날짜관련 작업을 위한 자바스크립트 라이브러리) (0) | 2020.02.11 |
[Javascript] 페이지를 떠날 때 경고창 띄우기 (0) | 2017.05.19 |