Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
Javascript libraries that allow for SQL-like queries on JSON data?

Say our JSON data comes from a single MySQL table:

someJSON =    [ { name: 'bill' , sex:'M', income:50000 },
                { name: 'sara' , sex:'F', income:100000 },
                 ...
               ];

And say the pseudo-code is:

"Get all the person objects of all sex:F of income > 60000`".

Are there any javascript libraries that would allow one to code such queries on this JSON data using a SQL or SQL-like syntax.

In case you are curious, some context:

I am making the front-end of a data analysis web service for my organization without knowing what the future backend will be. In the future they will migrate their data from MS Access tables to some-sort of MySQL-type database. Until then I am using static JSON files to start development and was thinking it may be helpful for them in the future to have my javascript queries appear as MySQL queries. (The current MS Access database is unreachable from the web.)

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Check out jslinq:

var myList = [
            {FirstName:"Chris",LastName:"Pearson"},
            {FirstName:"Kate",LastName:"Johnson"},
            {FirstName:"Josh",LastName:"Sutherland"},
            {FirstName:"John",LastName:"Ronald"},
            {FirstName:"Steve",LastName:"Pinkerton"}
            ];

var exampleArray = JSLINQ(myList)
                   .Where(function(item){ return item.FirstName == "Chris"; })
                   .OrderBy(function(item) { return item.FirstName; })
                   .Select(function(item){ return item.FirstName; });
over 4 years ago · Santiago Trujillo Report

0

You can try alasql.js. It is pure JavaScript client-side SQL-server, where you can do queries over JSON objects.

   // Fill table with data
   var data = [ { name: 'bill' , sex:'M', income:50000 },
                { name: 'sara' , sex:'F', income:100000 }];

   // Do the query
   console.log(alasql("SELECT * FROM ? WHERE sex='F' AND income > 60000",[data]));

Try this in Fiddle

over 4 years ago · Santiago Trujillo Report

0

I use Taffydb. TaffyDB is an opensouce library that brings database features into your JavaScript applications. http://taffydb.com/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!