json-object-query
v1.1.2
Published
Simple JSON property finder with ORM-like syntax
Downloads
60
Readme
JSON Query
Simple JSON property finder with ORM-like syntax, only for static site / simple website with small data. We not recommend for JSON file more than 1MB or recursively JSON with 5 children or more.
Usage
Install it using yarn add json-object-query
or npm install json-object-query
.
And then, follow this below example.
import Query from 'json-object-query'
const query = new Query('json string')
const result = query
.select('id, title')
.sort('id', 'desc')
.where('id', 10)
.limit(30)
.get()
console.log(result)
// [{ title: ..., description: ... }, ...]
API Usage
| Method | Description | Priorty | Default |
|:-----:|:-----|:-----:|:-----:|
| select
| Select a fields that will you use | 1 | All |
| where
| - | - | - |
| limit
| - | - | - |
| sort
| - | - | - |
| findOneBy
| - | - | - |
| whereLike
| - | - | - |
| whereBetween
| - | - | - |
| get
| - | - | - |
Source File
Thanks to JSON Placeholder for free JSON data that we use for example usage on this library.
License
This project under MIT License