
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
sqlite-json
Advanced tools
Convert Sqlite3 tables to JSON
Usage: sqlite-json [options] <database> <table>
Export a SQLite table to JSON
Options:
-h, --help output usage information
-V, --version output the version number
-o, --output <file> Save result to file
-c, --columns <list> Comma-delimited list of columns to output (Default: all)
-k, --key <key> Key output to column
-w, --where <clause> WHERE clause to add to table query
By default, the cli outputs to stdout.
$ sqlite-json data.db table --key ID -o output.json
$ sqlite-json data.db table | other_program > output.json
Create an instance of sqlite-json.
Example:
const sqliteJSON = require('sqlite-json');
const exporter = sqliteJson('example.db');
The path to an SQLite database or a sqlite3 client instance.
Type: sqlite3.Database
or string
Example:
const sqlite3 = require('sqlite3');
var db = new sqlite3.Database('./mydb.sqlite3');
exporter = sqliteJson(db);
Export JSON from a specified table, and use it in the given callback.
Example:
exporter.json('myTable', function (err, json) {
// handle error or do something with the JSON
// "[{"foo": 1}, {"foo": 2}, {"foo": 3}]"
});
An optional list of columns to output.
Type: Array
Example:
exporter.json('myTable', {columns: ['foo']}, function (err, json) {
// "[{"foo": 1}, {"foo": 2}, {"foo": 3}]"
});
An optional column name.
By default, the result is an JSON array of objects. If key
is given, a JSON object is returned, each row keyed to the given column value.
Type: string
Example:
exporter.json('myTable', {key: 'foo'}, function (err, json) {
// "{"1": {"foo": 1}, "2": {"foo": 2}, "3": {"foo": 3}}"
});
A where clause to add to the query.
Type: string
Example:
exporter.json('myTable', {where: 'foo > 1'}, function (err, json) {
// "[{"foo": 2}, {"foo": 3}]"
});
List all tables in the current database.
Example:
exporter.tables(function (err, tables) {
// tables === ['foo', 'bar', 'baz']
});
Save the contents of a table to the specified output file.
Example:
exporter.save('table_name', 'data/table_name.json', function (err, data) {
// Optionally do something else with the JSON.
});
FAQs
Convert Sqlite3 tables to JSON
The npm package sqlite-json receives a total of 11 weekly downloads. As such, sqlite-json popularity was classified as not popular.
We found that sqlite-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.