JMESPath for Swift

Swift implementation of JMESPath, a query language for JSON.


Below is a simple example of usage.

import JMESPath

let expression = try Expression.compile("a.b")
let result = try #"{"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
let expression = try Expression.compile("a.b[1]")
let test = TestObject(a: .init(b: ["hello", "world!"]))
let result = try, as: String.self)
assert(result == "world!")