OSS TanbouSign in with GitHub

navigate JSON in Swift and extract typed values safely

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
22,934
Primary language
Swift
License
MIT
Repository last updated
Aug 18, 2026
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

Extract selected values from external API responses

It fits code that must inspect a few paths without first defining a complete model. Add the fixed version with Swift Package Manager and verify a name and array count in a small executable.

Sources: [1][3]

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. [1]SwiftyJSON 5.0.2 README(2026-10-05)
  2. [2]SwiftyJSON 5.0.2 release(2026-10-05)
  3. [3]SwiftyJSON 5.0.2 Package.swift(2026-10-05)
  4. [4]SwiftyJSON MIT license(2026-10-05)
  5. [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. 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. 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. 3

    Verify the output

    Resolve and run with swift run, requiring Ada followed by 2.

    test "$(swift run -q Demo)" = $'Ada\n2'
Check the official README

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
Stars
22,934
Forks
3,415
Watchers
606
Open issues
118
Contributors
139
Owner type
Organization
Primary language
Swift
License
MIT
Repository last updated
Aug 18, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?