https://github.com/harehare/jq.mq
An implementation of jq JSON processor written in the mq
https://github.com/harehare/jq.mq
jq mq
Last synced: 5 months ago
JSON representation
An implementation of jq JSON processor written in the mq
- Host: GitHub
- URL: https://github.com/harehare/jq.mq
- Owner: harehare
- License: mit
- Created: 2025-08-03T14:12:39.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-08-03T14:15:09.000Z (5 months ago)
- Last Synced: 2025-08-03T16:11:12.215Z (5 months ago)
- Topics: jq, mq
- Language: Shell
- Homepage: https://mqlang.org/
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jq.mq
> [!WARNING]
> This project is currently under active development.
An implementation of jq JSON processor written in the [mq](https://github.com/harehare/mq).
## Overview
This project provides a implementation of the jq command-line JSON processor using the [mq](https://github.com/harehare/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:
```bash
# 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
```bash
# 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.