Skip to content
/ jsonQL Public

A small tool for querying a JSON object, support for inserting and updating rows is likely on it's way

Notifications You must be signed in to change notification settings

arextar/jsonQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Example use: (example object from csonv.js)
    
    dat=[
        {
            "id": 1,
            "name": "To Kill an Angry Bird",
            "author": {
                "id": 1,
                "name": "Harper Lee",
                "written_books": [
                    {
                        "$ref": "$[0]"
                    }
                ]
            }
        },
        {
            "id": 2,
            "name": "The Rabbit",
            "author": {
                "id": 2,
                "name": "JRR Tolkien",
                "written_books": [
                    {
                        "$ref": "$[1]"
                    },
                    {
                        "id": 4,
                        "name": "The Lord of the Things",
                        "author": {
                            "$ref": "$[1][\"author\"]"
                        }
                    }
                ]
            }
        },
        {
            "id": 3,
            "name": "Parslet",
            "author": {
                "id": 3,
                "name": "William Shakespeare",
                "written_books": [
                    {
                        "$ref": "$[2]"
                    }
                ]
            }
        },
        {
            "$ref": "$[1][\"author\"][\"written_books\"][1]"
        },
        {
            "id": 5,
            "name": "The Michelangelo Code",
            "author": {
                "id": 4,
                "name": "Dan Brown",
                "written_books": [
                    {
                        "$ref": "$[4]"
                    }
                ]
            }
        }
    ]
    
    jsonQuery(dat).select("author.id").where("name").like("To").get()
    
    Built to be used with csonv.js library (https://github.com/archan937/csonv.js)

How to extend:
    jsonQuery.test.has=function(a,b){
        return a[b];
    }

About

A small tool for querying a JSON object, support for inserting and updating rows is likely on it's way

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published