
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
npm-json2sql
Advanced tools
This package can be use to build a mysql query from json.
var json2sql=require('npm-json2sql');
myjson = {
"filters": { //you can add multiple column for filtering
"transaction_number": { //transaction_number is the column name
"value": "56",
"matchMode": "contains" //can be equal== '=' and contains== 'LIKE'
},
"supplier_id": {
"value": "2",
"matchMode": "equal"
},
"supplier_name": {
"value": "jack",
"matchMode": "contains"
}
},
//**Sorting and Pagination are optional features**
"first": 0, // Page Number
"rows": 10, // Num of Rows per page
"sortField": "total_amount", //Order by Field
"sortOrder": 1 //0==ASC and 1==DESC
};
console.log(json2sql.json2sql(myjson,"transactions"));
Select * from transactions
WHERE transaction_number
LIKE '%56%' AND supplier_id
= '2' AND supplier_name
LIKE '%jack%' ORDER BY total_amount
ASC limit 10 OFFSET 0
FAQs
This package can be used for building SQL from JSON
We found that npm-json2sql 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.