A pure Swift JSON encoding/decoding library with a strongly-typed API and comprehensive accessors.
PMJSON is a pure Swift library for encoding and decoding JSON data. It provides a strongly-typed API for parsing JSON into Swift types and serializing Swift values back to JSON, with an emphasis on safety, detailed error reporting, and compatibility with Swift's Codable protocol. It solves the problem of handling JSON in Swift with more precision and better error messages than Foundation's JSONSerialization.
Swift developers building iOS, macOS, watchOS, or tvOS applications, or any Swift project requiring robust JSON parsing without Foundation dependencies. It's particularly useful for those who need fine-grained control over JSON handling and detailed error diagnostics.
Developers choose PMJSON for its pure Swift implementation, comprehensive type-safe accessors, and superior error reporting that includes exact JSON paths. It offers a more Swifty alternative to JSONSerialization, with added features like JSON stream parsing and full Codable support.
Pure Swift JSON encoding/decoding library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables use in non-Apple environments without Foundation dependencies, enhancing cross-platform compatibility for Swift projects.
Errors include line/column numbers and descriptive JSON paths (e.g., 'object.elements[0].name: expected string, found null'), making debugging more precise.
Provides comprehensive methods like .getString() and .toInt() for safe JSON traversal, reducing runtime type errors with clear validation.
Parses multiple top-level JSON values from a continuous stream, useful for handling large files or real-time data without full memory load.
The original repository is archived, requiring users to switch to a fork, which introduces maintenance risks, potential breaking changes, and uncertainty.
According to the README, PMJSON's parsing is 2.5-3x slower than NSJSONSerialization, which can be a bottleneck for performance-sensitive applications.
With multiple accessor types (e.g., .get, .to, .as) and manual decoding steps, the API can be overwhelming for simple JSON tasks compared to more streamlined alternatives.