Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda