jmespath.swift

1.0.3

Swift implementation of JMESPath, the JSON query language
jmespath/jmespath.swift

What's New

v1.0.3

2024-08-02T06:57:56Z

Patch release changes

  • Remove internal import of CoreFoundation

Other changes

  • Replace usages of Data(contentsOf:) with URLSession.shared.data(from:) in tests
  • Add Windows CI

JMESPath for Swift

Swift implementation of JMESPath, a query language for JSON. This package is fully compliant with the JMESPath Specification

Usage

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!")

Description

  • Swift Tools 5.2.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Jul 05 2025 17:35:40 GMT-0900 (Hawaii-Aleutian Daylight Time)