1.2.4 • Published 5 years ago
query-2-json v1.2.4
query-2-json
Inspired by react-querybuilder
It is simple to use but would be easier to store the query string and convert it back to the json format from the string.
Installation
npm install query-2-json
Usage
const q2j = require('query-2-json')
let q = "(a != 1 || (b == 2 && c <= 3)) && (d != 4)"
let json = q2j(q, { brackets: ['()'] });
console.log(JSON.stringify(json, null, 2))
let rule = q2j(json);
console.log(rule)