jmespath.swift

0.2.4

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

What's New

v0.2.4

2021-06-07T14:26:59Z

Add support for Mirror collection and dictionary display types

JMESPath for Swift

Swift implementation of JMESPath, a query language for JSON.

Usage

Below is a simple example of usage.

import JMESPath

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

Description

  • Swift Tools 5.2.0

Dependencies

  • None
Last updated: Fri Jun 11 2021 02:49:09 GMT-0500 (GMT-05:00)