Skip to content

harehare/jq.mq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jq.mq

Warning

This project is currently under active development.

An implementation of jq JSON processor written in the mq.

Overview

This project provides a implementation of the jq command-line JSON processor using the mq. It supports JSON parsing, querying, and transformation with a familiar jq-like syntax.

Installation

To install jq.mq, simply copy the script to your ~/.mq directory:

# Create the ~/.mq directory if it doesn't exist
mkdir -p ~/.mq

# Copy jq.mq to ~/.mq
cp jq.mq ~/.mq/

Once copied, you can use jq.mq with the runner script as described below.

Usage

Using the Runner Script

# Make the script executable
chmod +x run.sh

# Basic usage
./run.sh '{"name": "John", "age": 30}' '.name'

# Array operations
./run.sh '[1,2,3,4,5]' 'length'

# Complex queries with pipes
./run.sh '{"users": [{"name": "Alice"}, {"name": "Bob"}]}' '.users[] | .name'

# Show help
./run.sh --help

Implementation Details

The implementation is structured into several key components:

  1. JSON Parser - Converts JSON strings into mq data structures
  2. Query Tokenizer - Breaks down jq queries into executable tokens
  3. Execution Engine - Processes queries against JSON data
  4. Built-in Functions - Implements standard jq functions
  5. Output Formatter - Converts results back to JSON format

License

This project is provided as-is for educational and demonstration purposes.

About

An implementation of jq JSON processor written in the mq

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages