All Projects → g-mark → SwiftPath

g-mark / SwiftPath

Licence: MIT License
JSONPath for Swift

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to SwiftPath

JPStream
JPStream: JSONPath Stream Processing in Parallel
Stars: ✭ 19 (-58.7%)
Mutual labels:  jsonpath
LBDuoDian
No description or website provided.
Stars: ✭ 21 (-54.35%)
Mutual labels:  jsonpath
xapi-profiles
A set of documents addressing the structure of and supporting services for xAPI Profiles.
Stars: ✭ 47 (+2.17%)
Mutual labels:  jsonpath
SMJJSONPath
JSONPath implementation in Objective-C
Stars: ✭ 28 (-39.13%)
Mutual labels:  jsonpath
mapneat
MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJO to JSON in a declarative way.
Stars: ✭ 45 (-2.17%)
Mutual labels:  jsonpath
web-data-extractor
Extracting and parsing structured data with jQuery Selector, XPath or JsonPath from common web format like HTML, XML and JSON.
Stars: ✭ 52 (+13.04%)
Mutual labels:  jsonpath
JsonPathKt
A lighter and more efficient implementation of JsonPath in Kotlin
Stars: ✭ 37 (-19.57%)
Mutual labels:  jsonpath
jsonuri
🌳 阿里剑鱼、iceluna、vanex 数据操作底层库,使用O(n) 复杂度回溯祖先节点
Stars: ✭ 131 (+184.78%)
Mutual labels:  jsonpath
jessie
JsonPath for Dart
Stars: ✭ 23 (-50%)
Mutual labels:  jsonpath
JSONPath.sh
JSONPath implementation in Bash for filtering, merging and modifying JSON
Stars: ✭ 45 (-2.17%)
Mutual labels:  jsonpath
ctxexp-parser
In the dynamic execution of JS language environment (wechat applet) to execute JS class calling function.
Stars: ✭ 17 (-63.04%)
Mutual labels:  jsonpath
robotframework-jsonvalidator
Robot Framework library for JSON validation
Stars: ✭ 21 (-54.35%)
Mutual labels:  jsonpath
json-path-comparison
Comparison of the different implementations of JSONPath and language agnostic test suite.
Stars: ✭ 64 (+39.13%)
Mutual labels:  jsonpath
fs2-data
streaming data parsing and transformation library
Stars: ✭ 103 (+123.91%)
Mutual labels:  jsonpath
jsonpath
No description or website provided.
Stars: ✭ 117 (+154.35%)
Mutual labels:  jsonpath
ajson
Abstract JSON for Golang with JSONPath support
Stars: ✭ 144 (+213.04%)
Mutual labels:  jsonpath
yamlpath
Command-line get/set/merge/validate/scan/convert/diff processors for YAML/JSON/Compatible data using powerful, intuitive, command-line friendly syntax.
Stars: ✭ 78 (+69.57%)
Mutual labels:  jsonpath
json matcher
Library for simplifying data verification in functional tests for your JSON-based APIs
Stars: ✭ 24 (-47.83%)
Mutual labels:  jsonpath

SwiftPath

Build Status Swift 4.2-5.3 compatible swift-package-manager CocoaPods compatible License: MIT

JSONPath for Swift

Problem

Somtimes, you don't want to hard-code the mapping from JSON to your model. You may want a generic way to model data from different sources. You may want to be able to update your remote data structure without having to update your app binary.

Solution

SwiftPath allows you to keep your data source and your data mapping dynamic.

Installation

SwiftPath is available through CocoaPods and Carthage.

CocoaPods

pod "SwiftPath"

Carthage

github "g-mark/SwiftPath" "master"

Documentation

SwiftPath is a Swift implementation of JSONPath, which allows you to extract a subset of data from a larger chunk of JSON.

Sipmle usage

Wildcards

You can add a wildcard to objects to convert the current object to an array of it's values:

// Given:
{
  "books" : {
    "one" : { "title": "one" },
    "two" : { "title": "two" },
    "three" : { "title": "three" }
  }
}

// When using this path:
$.books.*

// Then you'll get this output:
[ { "title": "one" }, { "title": "two" }, { "title": "three" } ]

Mapping properties

This is a difference from the JSONPath 'spec'. With SwiftPath, you can re-map property names to match your model in code. When collecting a subset of properties, you can do things like this (renamning the value property to id):

// Given:
[
  {"name": "one", "value": 1, "extra": true },
  {"name": "one", "value": 2, "extra": true },
  {"name": "one", "value": 3, "extra": true }
]

// When using this path:
$['name', 'value'=>'id']

// Then you'll get this output:
[
  {"name": "one", "id": 1 },
  {"name": "one", "id": 2 },
  {"name": "one", "id": 3 }
]

Publishing

To publish a new version of SwiftPath:

  1. Update version number in SwiftPath.podspec
  2. Create a release branch off of production with version: e.g., release/#.#.#
  3. Merge develop into release/version branch
  4. Create PR into production from release/version branch
  5. Once CI passess, tag it with #.#.#, merge into production, and delete the release/version branch
  6. Run pod trunk push SwiftLint.podspec
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].