jpx

JMESPath query tool with 320+ extended functions for JSON transformation and analysis

jmespath-extensions

Crates.io Documentation CI

Extended JMESPath with 400+ functions. Available as a CLI, MCP server, Rust library, and Python bindings.

Documentation | Function Reference

Quick Start

# Install
brew install joshrotenberg/brew/jpx
# or: cargo install jpx

# Use it
echo '{"name": "world"}' | jpx 'upper(name)'
# "WORLD"

curl -s https://api.github.com/users/octocat | jpx '{
  login: login,
  created: format_date(parse_date(created_at), `%B %Y`)
}'
# {"login": "octocat", "created": "January 2011"}

What's Included

PackageDescription
jpxCLI tool with REPL, multiple output formats
jpx-serverMCP server for AI assistants
jmespath-extensionsRust library
jmespath-extensions-pyPython bindings

MCP Server

Give Claude (or any MCP client) the ability to query and transform JSON:

{
  "mcpServers": {
    "jpx": {
      "command": "jpx-server"
    }
  }
}

Tools: evaluate, batch_evaluate, validate, functions, describe, search, similar, format, diff, patch, merge, stats, paths, keys

Function Categories

CategoryExamples
Stringupper, lower, split, replace, camel_case, pad_left
Arrayfirst, last, unique, chunk, zip, flatten, group_by
Mathround, sqrt, median, stddev, percentile
Date/Timenow, parse_date, format_date, date_add, date_diff
Hashmd5, sha256, hmac_sha256, crc32
Encodingbase64_encode, base64_decode, hex_encode, url_encode
Regexregex_match, regex_extract, regex_replace
Geohaversine, geo_distance_km, geo_bearing
Networkcidr_contains, is_private_ip, ip_to_int
JSON Patchjson_patch, json_merge_patch, json_diff
Fuzzylevenshtein, jaro_winkler, soundex, metaphone
Expressionmap_expr, filter_expr, sort_by_expr, group_by_expr

Full function reference

A Taste

# Filter and transform
echo '[{"name":"alice","age":30},{"name":"bob","age":25}]' \
  | jpx '[?age > `26`].{name: upper(name), birth_year: `2024` - age}'
# [{"name": "ALICE", "birth_year": 1994}]

# Fuzzy matching
jpx 'levenshtein(`kitten`, `sitting`)'
# 3

# Date arithmetic  
jpx 'format_date(date_add(now(), `7`, `days`), `%Y-%m-%d`)'
# "2024-01-24"

# Network validation
echo '["10.0.0.1", "8.8.8.8", "192.168.1.1"]' \
  | jpx '[?is_private_ip(@)]'
# ["10.0.0.1", "192.168.1.1"]

Library Usage

Rust

use jmespath_extensions::search;
use serde_json::json;

let data = json!({"items": [1, 2, 3, 4, 5]});
let result = search("sum(items)", &data)?;
assert_eq!(result, json!(15));

Python

import jmespath_extensions as jpx

data = {"items": [1, 2, 3, 4, 5]}
result = jpx.search("sum(items)", data)
assert result == 15

Acknowledgments

License

MIT or Apache-2.0

Related Servers