json to jsonl (json lists) 변경하기
작업을 하던중 json 파일을 jsonl 형태로 변환해달라는 요청을 받았다. 몇개의 npm 라이브러리 중 결론적으론 jsonl 이라는 npm 라이브러리를 사용했다. $ npm install --save jsonl npm jsonl 라이브러리를 설치한다. 아래의 코드를 이용하여 const fs = require("fs") const jsonl = require("jsonl") let filePath = './files/data.json' fs.createReadStream(`${filePath}.json`) .pipe(jsonl()) .pipe(fs.createWriteStream(`${filePath}.jsonl`)) data.json 파일 [ { "name":"아이유" }, { "name":"빈센조" ..