npm.io
1.2.4 • Published 6 years ago

query-2-json

Licence
MIT
Version
1.2.4
Deps
1
Size
16 kB
Vulns
0
Weekly
0

query-2-json

Build Status npm version npm

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)

Keywords