A Node.js library that translates MongoDB-style query objects into SQL queries. Version 0.5.0 is the current stable release, though development activity appears low. It is not a database driver; it only generates SQL strings and parameter values for use with any SQL driver (e.g., node-postgres). Supports SELECT, INSERT, UPDATE, DELETE, JOINs, nested conditions, and parameterized queries with automatic variable naming. Differentiators include a simple JSON-based query syntax, no DSL, and zero runtime dependencies.
npm install json-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic SELECT query with parameterized condition using json-sql.
Call require('json-sql')() once and reuse the instance, or use the builder export.const sql = require('json-sql')({ valuesPrefix: 'param' });Use { age: { $gt: 18 } } instead of { age: 18 } for greater-than.Consider alternatives like squel.js or knex.js for active maintenance.
Use `import jsonSql from 'json-sql'; const sql = jsonSql();` with `esModuleInterop` enabled, or use `const jsonSql = require('json-sql')();`.First invoke the factory: `const jsonSql = require('json-sql')();` then call `jsonSql.build(...)`.Use `type: 'remove'` for delete operations.
No dependency data recorded yet.