JSON.parse(obj) 함수를 쓰세요
스크립트 태그를 사용하여 브라우저에서 json 파일을 로드하는 것은 아직 지원되지 않습니다.
가장 쉬운 방법은 Fetch 메서드를 통해 로드하는 것입니다.
fetch('./file.json')
.then(response => response.json())
.then(obj => console.log(obj))
© 2023 OneMinuteCode. All rights reserved.