Swiftpack.co -  adam-fowler/jmespath.swift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Swift implementation of JMESPath, the JSON query language
.package(url: "https://github.com/adam-fowler/jmespath.swift.git", from: "0.3.0")

JMESPath for Swift

Swift implementation of JMESPath, a query language for JSON.


Below is a simple example of usage.

import JMESPath

// compile query "a.b"
let expression = try JMESExpression.compile("a.b")
// use query to search json string
let result = try expression.search(json: #"{"a": {"b": "hello"}}"#, as: String.self)
assert(String == "hello")

JMESPath will also use Mirror reflection to search objects already in memory

struct TestObject {
  struct TestSubObject {
      let b: [String]
  let a: TestSubObject
// compile query "a.b[1]"
let expression = try JMESExpression.compile("a.b[1]")
let test = TestObject(a: .init(b: ["hello", "world!"]))
// use query to search `test` object
let result = try expression.search(object: test, as: String.self)
assert(result == "world!")


Stars: 20
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

2 weeks ago
  • Renamed Expression to JMESExpression
  • Got tests compiling on iOS

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API