Skip to content

ayrtonvwf/jsonql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JSONQL

A Universal Query Language based on JSON

About

This project aims to provide a way to universaly define queries that can be used to:

  • Actually query existing data at runtime;
  • Be a intermediary between language diallects (Ex.: Language A -> JSONQL -> Language B);
  • Be used as documentation of conditions (Ex.: Said API endpoint returns user entities that match said JSONQL Query).

JSONQL does not compete with JSON Schema. JSON Schema's speciality is to define data structure, while JSONQL's speciality is to query actual data of any complexity.

Specification

The Query Object

See the schema

The Property Locator

A Property Locator is a sequence of property names used to identify a nested data point in the data structure.

Structure example:

[
    {
        "id": 1,
        "users": [
            {
                "id": 1,
                "name": "John",
                "age": 31
            }, {
                "id": 2,
                "name": "Marie",
                "age": 42
            }
        ]
    }, {
        "id": 2,
        "users": [
            {
                "id": 3,
                "name": "Albert",
                "age": 18
            }
        ]
    },
]

Example Property Locators:

  • ["users"]: The "users" of the objects in the root array;
  • ["users", "name"]: The "name" property of the objects in the "users" arrays;

The response

The response of a query is expected to be an array of objects.

When querying a single object, the array will contain the single object.

When querying a single value, the array will contain a single object with the single property.

About

A Universal Query Language based on JSON

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published