Convert SQLite to JSON
(1) By anonymous on 2021-02-25 23:06:00 [link] [source]
Hello! I'm trying to convert SQLite tables into JSON files from Windows command-line (but completely from command line.. I need to create a batch later) without success. Can anyone explain which would be the correct command to achieve this? Thanks!
(2) By Decker (d3x0r) on 2021-02-26 00:38:22 in reply to 1 [link] [source]
Depends on what you're familiar with; Node.JS with sack.vfs can do it pretty simply...
just open a database const db = sack.Sqlite('db.db')
and select something... JSON.stringify( db.do( 'select something from a_table'))
https://www.npmjs.com/package/sack.vfs
https://github.com/d3x0r/sack.vfs/blob/master/tutorial/tutorial-sqlite.md
(3.1) By Warren Young (wyoung) on 2021-02-26 05:28:56 edited from 3.0 in reply to 1 [source]
Given SQLite 3.33.0 or higher:
C:\> sqlite3 -json file.db "select * from MyTableName" > file.json