Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/imteekay/sql-query-json

Experiment SQL-query in JavaScript for JSON
https://github.com/imteekay/sql-query-json

javascript js json query sql sql-query

Last synced: 28 days ago
JSON representation

Experiment SQL-query in JavaScript for JSON

Awesome Lists containing this project

README

        

# SQL Query JSON

Experiment SQL-query in JavaScript for JSON

You have this JSON:

```javascript
const json = {
users: [
{
'id': 1,
'name': 'TK',
'age': 26,
'email': '[email protected]'
},
{
'id': 2,
'name': 'Daniel',
'age': 30,
'email': '[email protected]'
},
{
'id': 3,
'name': 'Kaio',
'age': 11,
'email': '[email protected]'
}
]
};
```

And you want this interface (like a SQL query):

```javascript
select(['id', 'name'])
.from('users')
.where('id', 1);
```

An the result should be:

```javascript
[{ id: 1, name: 'TK' }]
```