Created a simple query language for JSON data.

Features:

  • Basic query selection
  • Fallback Mechanism
  • Wildcard support
  • Array Slices
  • Multiple Key Selection
  • Key Omission
  • Single Key Omission
  • Functions
  • Comparison Operators
  • Conditions
  • Configurable

Here’s an example to get the list of adult friends:

$.friends[?(@.age >= 18)]

Runs in browsers, and Node.js

Documentation site: https://jqlite.vercel.app/

GitHub: https://github.com/Jay-Karia/jqlite

NPM Package: https://www.npmjs.com/package/jqlite-ts

⭐ Leaving a star on GitHub is much appreciated!

    • jay0072007OP
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      3 天前

      Thanks for sharing the project! JQLite is aimed to run in browsers and node, but will definitely take inspiration from “jq”.

      • Azzu@lemm.ee
        link
        fedilink
        arrow-up
        14
        ·
        edit-2
        3 天前

        I just kinda wonder why when you’re in a browser or node, you wouldn’t just do

        const json = {...};
        json.friends.filter(f => f.age >= 18);
        

        why learn another language when you already literally got the language to process JavaScript Object Notation right there.

        • jay0072007OP
          link
          fedilink
          arrow-up
          10
          arrow-down
          1
          ·
          3 天前

          100% agreed. It’s just a learning/hobby project, to know more about parsers, and how languages work. Some of the features like Wildcard, Multiple key selection/omission comes handy, and might add more features like that.