Swiftpack.co -  Tallak-Lippe/YoloJson as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Easily extract values from json
.package(url: "https://github.com/Tallak-Lippe/YoloJson.git", from: "0.1.0")


YoloJson makes scripting with json much easier. It is perfect for getting only a few values from an api without recreating the whole json structure. You simply write the path to the value you want and cast the it like this:

let data = //Some networking code

let ID = data["_embedded"]["recommendations"][0]["series"]["id"] as! String

You can also access whole arrays and dictionaries to use powerful functions like map, filter and reduce like this:

let allIDs: [String] = data["_embedded"]["recommendations"].array.map {
    $0["series"]["id"] as! String

But be careful! There are no error- handling in this framework so you have to be sure your paths and json data is correct. This framework is mainly meant for scripting and prototyping.

Please let me know @TallakLippe on twitter or create a PR if there is anything I can / should improve. I will work on some more descriptive error-messages soon.

The examples here are made and tested with json data from NRK.


Stars: 0
Last commit: 5 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

First release
5 weeks ago

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