Example JSON

Users can experiment with the sample json object that can be accessed by clicking the Load Example button on the home page. Future sections of the doc will use the sample json to provide example queries.

Introduction

This tool treats a javascript objects as table and provides features to query it using a sql-like syntax.

FROM Clause

By convention the FROM clause states the table to be queried.
Keeping conventions intact the FROM clause helps the user specify which object to query from.
If we wanted to query FROM the sample JSON, we could specify 'country' (Case-sensitive) in the FROM clause. Users can query from nested objects.

SELECT Clause

By convention the SELECT clause states the columns of the tables.
If a javascript object is your table, it is but obvious the various keys in the object serve as its columns. User must input keys of the javascript object in the select clause. If we wanted to SELECT columns from the sample JSON, we could specify 'name' or 'captial' (Case-sensitive) in the SELECT clause.
Again keeping conventions intact entering a '*' will select all the keys in the object. Users can select nested keys.

WHERE Clause

WHERE clause serves to filter results in a table.
In here a user is expected to provide a javascript function that evaluates to a boolean. More details at where clause doc.

The sample json contains an array of json objects.

Select all columns

A simple query to select all the keys in the nested objects would be
select *
from country

Select specific columns

A query to list the names and the capitals would be
select name, capital
from country

All the values in the SELECT and FROM clauses are case sensitive

The sample json contains an array of json objects.

Query only the first object in the array

To query the first object in the array the user would need to enter a valid json path in the FROM clause. The resulting query would be
select *
from country.0

Querying using valid json paths

If the user wanted to query for dignitaries in the first object the query would be
select *
from country.0.dignitaries

All the values in the SELECT and FROM clauses are case sensitive

The sample json contains an array of json objects.

Selecting nested properties

To view the dignitaries across all the object a user can specify valid json paths in the SELECT clause
select dignitaries.president
from country

Note

When specyfing nested json paths in the SELECT clause, the json paths must be relative to the object mentioned in the FROM clause

All the values in the SELECT and FROM clauses are case sensitive

The sample json contains an array of json objects.

WHERE clause to filter

User is expected to input a javascript expression that will evaluate to a boolean
For eg. if the user wanted to view all the data assoicated with 'India', the query would be
select *
from country
where this.name === 'India'

Note

When referencing to keys / object properties, (name in the above example), keys must meet the following conditions

  • All keys must be referenced by the this keyword
  • All keys must be relative to the object mentioned in the FRP< clause

All the values in the SELECT and FROM clauses are case sensitive

Using the tree view to fetch JSON paths.

It can become a tedious task to specify valid json paths in the SELECT and the FROM clauses. Users can select a node by click on it. Users can then either use the Use Selected Node in From button to get the json path to the FROM clause and similarly use the Use Selected Node in Select button to get the JSON path to the SELECT clause.

Note

Currently when selecting json path to the SELECT clause does not account for the JSON path being relative to the object in the FROM clause. It is still being worked on.