The language provides you with some nice features, so there's no need for wrapping SQL over JS:
var data=[{"firstName":"Alice", "age":"16"},{"firstName":"Bob", "age":"18"} ... {"firstName":"Zacharias", "age":"37"}]
If you want to SELECT * FROM json WHERE age>16, you could do something equivalent in JS:
data.filter(function(x){ return x.age>16 })
If you want to SELECT count(*) FROM json you just write
data.length;
If you want to SELECT avg(age) FROM json you could write
data.reduce(function(o,n){ return o+(n.age/data.length) }, 0)
If you want to SELECT sum(age) from json you could write
data.reduce(function(o,n){ return o+n.age*1 },0) 
So why not using, what the language gives you?
Edit: I saw, you specified your needs. What exactly is the transformation needed? I think there should be a JS-way, to do, what you want.
Edit2: For tabular representation, you have to do a reduce over all data. For the example I simplified a little bit:
var aaData=[{"country":"USA", "month":"1", "earnings":"1000"}, {"country":"USA", "month":"2", "earnings":"1001"},     {"country":"USA", "month":"3", "earnings":"1002"}, {"country":"Germany", "month":"1", "earnings":"1000"},     {"country":"Germany", "month":"2", "earnings":"1001"}, {"country":"Germany", "month":"3", "earnings":"1002"}]
var result=aaData.reduce(function(o, n){
    if (!o.hasOwnProperty(n.country)) o[n.country]={};
    o[n.country][n.month]=n.earnings;
    return o;
}, {})
Here is a JSFiddle to play with.