2

I am dealing with large json files with deep hierarchical structure on the frontend and I want to be able to query and aggregate them efficiently,the same way I query mongoDB or redis collections.

I am aware of two libraries:

  1. Minimongo which I'm not sure if can be used independently without using the entire Blaze/Meteor framework.
  2. and JSLINQ

any other suggestions, tricks ?

Edit:

there is also another library called json:select() which provides an API similar to CSS selectors

Nikos M.
  • 8,033
  • 4
  • 36
  • 43
MostafaMV
  • 2,181
  • 3
  • 16
  • 22
  • this is easily a matter of taste/coding style question, since parameters to select a specific solution are not given – Nikos M. Mar 11 '15 at 17:26
  • edited the post: parameters: efficiency, flexibility and possibly aggregation. Something similar to MongoDB or Redis. – MostafaMV Mar 11 '15 at 17:36
  • note that the dependencies of minimongo are listed in the projects page, so from this sense it is a rather large codebase to include for this task only – Nikos M. Mar 11 '15 at 17:42
  • added jsperf tests for various json-selector libraries, thuis should objectuively answer the efficiency part – Nikos M. Mar 11 '15 at 17:49

1 Answers1

2

How about JSONSelect (css-like selectors for json data)?

or JSONPath (xpath-like API for JSON)

plus if your JSON data/files are very large you may consider some streaming JSON library

For efficiency one can check tests on jsperf for various json-selector libraries (examples below)

  1. jsperf:json-select
  2. jspath vs JSONSelect vs jsonpath
  3. One can also create custom jsperf tests for specific cases

For size, the various libraries can be measured according to codebase(+dependencies) size

For example, note that the dependencies of minimongo are listed in the projects page, so from this sense it is a rather large codebase to include for this task only.

Then the selection of a library depends on the criteria of efficiency vs size.

A blog post (2012) on "8 ways to query json structures"

  1. JsonSQL
  2. JsonPath
  3. jfunk
  4. TaffyDB
  5. linq.js
  6. objeq
  7. JsonSelect
  8. Javascript Array Filtering
Nikos M.
  • 8,033
  • 4
  • 36
  • 43