On this page
Overview
SwiftyJSON is a Swift library for navigating JSON with subscripts and extracting strings, numbers, and other values. It accepts Foundation Data or objects and exposes type and missing-value errors.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Read nested JSON with subscripts and typed accessors
JSON(data:) values can be navigated as json["users"][0]["name"].stringValue. Optional accessors, defaulting accessors, and error expose different missing-value and type-mismatch behavior.
Sources: [1]
Best fit
Before adoption
Choose its role alongside Codable and handle failures explicitly
Codable is also relevant when a stable schema and whole-model validation matter. Defaulting accessors such as stringValue turn failures into defaults, so required fields should inspect an optional value or error.
Sources: [1]
Official sources
- [1]SwiftyJSON 5.0.2 README(2026-10-05)
- [2]SwiftyJSON 5.0.2 release(2026-10-05)
- [3]SwiftyJSON 5.0.2 Package.swift(2026-10-05)
- [4]SwiftyJSON MIT license(2026-10-05)
- [5]SwiftyJSON GitHub metadata(2026-10-05)
Supplemental curator note
SwiftyJSON fits Swift developers who need concise access to imperfect API JSON. Check errors and typed accessors rather than hiding missing or mismatched values.
Try it in 3 steps
- 1
Create a Swift package pinned to the release
Requires Swift 5.6 or later and Git. Create a temporary executable package pinned to SwiftyJSON 5.0.2.
demo=$(mktemp -d "${TMPDIR:-/tmp}/swiftyjson-demo.XXXXXX") && cd "$demo" && printf '%s\n' '// swift-tools-version:5.6' 'import PackageDescription' 'let package = Package(name: "Demo", dependencies: [.package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", exact: "5.0.2")], targets: [.executableTarget(name: "Demo", dependencies: ["SwiftyJSON"])])' > Package.swift && mkdir -p Sources/Demo - 2
Write nested JSON access
Parse a users array from Data and extract the first name and array count with typed accessors.
printf '%s\n' 'import Foundation' 'import SwiftyJSON' 'let data = #"{"users":[{"name":"Ada"},{"name":"Linus"}]}"#.data(using: .utf8)!' 'let json = try JSON(data: data)' 'print(json["users"][0]["name"].stringValue)' 'print(json["users"].arrayValue.count)' > Sources/Demo/main.swift - 3
Verify the output
Resolve and run with swift run, requiring Ada followed by 2.
test "$(swift run -q Demo)" = $'Ada\n2'
Growth
Growth trends · Last 30 days
22,934 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 0
- Open PRs
- 21
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- swiftyjson
- json
- swift
- response
- request
- carthage
- cocoapods
- json-parsing-library
- json-parser
- json-parsing-swift
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- jq35,745 Stars
1 shared tag(s)
slice, filter, transform, and aggregate JSON inside shell pipelines
C - Biome25,899 Stars
1 shared tag(s)
combine formatting, linting, fixes, and editor diagnostics in one fast tool
Rust - Gson24,234 Stars
1 shared tag(s)
serialize and deserialize Java objects to JSON without requiring annotations on every model
Java - Ajv14,850 Stars
1 shared tag(s)
compile JSON Schema or JTD contracts into fast runtime validators for API and configuration data
TypeScript - opa12,322 Stars
1 shared tag(s)
Define authorization and configuration rules in Rego and evaluate them separately
Go - Json.NET11,312 Stars
1 shared tag(s)
Handle .NET object conversion, manual JSON manipulation, and streaming through one API family
C#
Report incorrect information
Tell us if any listing information is incorrect or outdated.