Warning
This project is currently under active development.
An implementation of jq JSON processor written in the mq.
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.
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.
# 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 --helpThe implementation is structured into several key components:
- JSON Parser - Converts JSON strings into mq data structures
- Query Tokenizer - Breaks down jq queries into executable tokens
- Execution Engine - Processes queries against JSON data
- Built-in Functions - Implements standard jq functions
- Output Formatter - Converts results back to JSON format
This project is provided as-is for educational and demonstration purposes.