{"id":41904808,"url":"https://github.com/mattt/swift-yyjson","last_synced_at":"2026-02-06T14:30:12.133Z","repository":{"id":333356348,"uuid":"1128601025","full_name":"mattt/swift-yyjson","owner":"mattt","description":"A fast JSON library for Swift, powered by yyjson","archived":false,"fork":false,"pushed_at":"2026-01-18T19:37:20.000Z","size":201,"stargazers_count":51,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-03T18:38:29.433Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-05T22:10:54.000Z","updated_at":"2026-01-27T03:50:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mattt/swift-yyjson","commit_stats":null,"previous_names":["mattt/swift-yyjson"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mattt/swift-yyjson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattt%2Fswift-yyjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattt%2Fswift-yyjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattt%2Fswift-yyjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattt%2Fswift-yyjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattt","download_url":"https://codeload.github.com/mattt/swift-yyjson/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattt%2Fswift-yyjson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29164855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T12:44:37.655Z","status":"ssl_error","status_checked_at":"2026-02-06T12:44:13.991Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-25T15:14:53.381Z","updated_at":"2026-02-06T14:30:12.095Z","avatar_url":"https://github.com/mattt.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YYJSON\n\nA fast JSON library for Swift,\npowered by [yyjson](https://github.com/ibireme/yyjson).\n\nYYJSON provides API-compatible alternatives for\n`JSONEncoder`, `JSONDecoder`, and `JSONSerialization`.\nIt supports configurable compile-time options via\n[Swift package traits](https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/packagetraits/)\nfor further optimization.\n\n## Benchmarks\n\nYYJSON delivers significant performance improvements\nover Foundation's JSON APIs.\nThese benchmarks compare parsing times\nusing standard JSON test fixtures from\n[nativejson-benchmark](https://github.com/miloyip/nativejson-benchmark).\n\n| Fixture                      |  YYJSON | Foundation | Speedup |\n| :--------------------------- | ------: | ---------: | ------: |\n| `twitter.json` (~632KB)      | ~180 μs |    ~2.9 ms |    ~16× |\n| `citm_catalog.json` (~1.7MB) | ~425 μs |    ~4.3 ms |    ~10× |\n| `canada.json` (~2.2MB)       | ~2.3 ms |   ~36.0 ms |    ~16× |\n| `tokenizer.json` (~11MB)     | ~6.5 ms |   ~57.0 ms |     ~9× |\n\nYYJSON also uses significantly less memory.\nParsing twitter.json requires only 3 allocations compared to over 6,600 for Foundation,\nwith peak memory of 19 MB versus up to 378 MB.\nFor maximum efficiency,\n[in-place parsing](#in-place-parsing)\neliminates allocations entirely by operating directly on the input buffer.\n\nThe performance advantage is most pronounced for large files,\naccess-heavy workloads where YYJSON's value-based API avoids repeated type casting,\nand number-heavy data like GeoJSON that benefits from optimized floating-point parsing.\n\nFor detailed methodology and additional benchmarks,\nsee [swift-yyjson-benchmark](https://github.com/mattt/swift-yyjson-benchmark).\n\n\u003cdetails\u003e\n\n\u003csummary\u003eRaw Results\u003c/summary\u003e\n\n```shell\nswift package benchmark --format markdown --filter \"Fixture/.+/Parse/.+\" --time-units microseconds\n```\n\n```console\nHost 'MacBook-Pro.local' with 16 'arm64' processors with 48 GB memory, running:\nDarwin Kernel Version 25.2.0: Tue Nov 18 21:09:56 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6041\n```\n\n### Fixture/canada.json/Parse/Foundation\n\n| Metric                     |    p0 |   p25 |   p50 |   p75 |   p90 |   p99 |  p100 | Samples |\n| :------------------------- | ----: | ----: | ----: | ----: | ----: | ----: | ----: | ------: |\n| Instructions (M) \\*        |   308 |   308 |   308 |   308 |   309 |   312 |   312 |      85 |\n| Malloc (total) (K) \\*      |   167 |   167 |   167 |   167 |   167 |   167 |   167 |      85 |\n| Memory (resident peak) (M) |    17 |   148 |   274 |   394 |   478 |   524 |   524 |      85 |\n| Throughput (# / s) (#)     |    88 |    85 |    85 |    84 |    83 |    82 |    82 |      85 |\n| Time (total CPU) (μs) \\*   | 11425 | 11731 | 11821 | 11969 | 12034 | 12234 | 12234 |      85 |\n| Time (wall clock) (μs) \\*  | 11419 | 11723 | 11821 | 11969 | 12034 | 12227 | 12227 |      85 |\n\n### Fixture/canada.json/Parse/YYJSON\n\n| Metric                     |   p0 |  p25 |  p50 |  p75 |  p90 |  p99 | p100 | Samples |\n| :------------------------- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ------: |\n| Instructions (M) \\*        |   35 |   35 |   35 |   35 |   35 |   35 |   35 |     790 |\n| Malloc (total) \\*          |    3 |    3 |    3 |    3 |    3 |    3 |    3 |     790 |\n| Memory (resident peak) (M) |   17 |   22 |   22 |   22 |   22 |   22 |   22 |     790 |\n| Throughput (# / s) (#)     |  861 |  810 |  802 |  795 |  787 |  760 |  745 |     790 |\n| Time (total CPU) (μs) \\*   | 1163 | 1236 | 1249 | 1261 | 1274 | 1318 | 1344 |     790 |\n| Time (wall clock) (μs) \\*  | 1162 | 1234 | 1247 | 1258 | 1271 | 1316 | 1342 |     790 |\n\n### Fixture/citm_catalog.json/Parse/Foundation\n\n| Metric                     |   p0 |  p25 |  p50 |  p75 |  p90 |  p99 | p100 | Samples |\n| :------------------------- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ------: |\n| Instructions (M) \\*        |   73 |   73 |   73 |   73 |   73 |   73 |   74 |     297 |\n| Malloc (total) (K) \\*      |   14 |   14 |   14 |   14 |   14 |   14 |   14 |     297 |\n| Memory (resident peak) (M) |   18 |   90 |  161 |  230 |  276 |  301 |  301 |     297 |\n| Throughput (# / s) (#)     |  312 |  304 |  301 |  296 |  284 |  276 |  273 |     297 |\n| Time (total CPU) (μs) \\*   | 3205 | 3293 | 3330 | 3383 | 3521 | 3633 | 3660 |     297 |\n| Time (wall clock) (μs) \\*  | 3203 | 3291 | 3328 | 3381 | 3518 | 3629 | 3659 |     297 |\n\n### Fixture/citm_catalog.json/Parse/YYJSON\n\n| Metric                     |   p0 |  p25 |  p50 |  p75 |  p90 |  p99 |  p100 | Samples |\n| :------------------------- | ---: | ---: | ---: | ---: | ---: | ---: | ----: | ------: |\n| Instructions (K) \\*        | 9850 | 9855 | 9855 | 9855 | 9855 | 9871 | 10528 |    2871 |\n| Malloc (total) \\*          |    3 |    3 |    3 |    3 |    3 |    3 |     3 |    2871 |\n| Memory (resident peak) (M) |   18 |   22 |   22 |   22 |   22 |   22 |    22 |    2871 |\n| Throughput (# / s) (#)     | 3253 | 3075 | 3025 | 2973 | 2929 | 2801 |  2590 |    2871 |\n| Time (total CPU) (μs) \\*   |  309 |  327 |  332 |  338 |  343 |  359 |   392 |    2871 |\n| Time (wall clock) (μs) \\*  |  307 |  325 |  331 |  336 |  342 |  357 |   386 |    2871 |\n\n### Fixture/twitter.json/Parse/Foundation\n\n| Metric                     |   p0 |  p25 |  p50 |  p75 |  p90 |  p99 | p100 | Samples |\n| :------------------------- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ------: |\n| Instructions (M) \\*        |   44 |   44 |   44 |   44 |   44 |   44 |   44 |     501 |\n| Malloc (total) \\*          | 6636 | 6637 | 6637 | 6637 | 6637 | 6637 | 6637 |     501 |\n| Memory (resident peak) (M) |   18 |  108 |  198 |  285 |  342 |  374 |  378 |     501 |\n| Throughput (# / s) (#)     |  531 |  514 |  510 |  505 |  492 |  455 |  436 |     501 |\n| Time (total CPU) (μs) \\*   | 1887 | 1946 | 1964 | 1985 | 2032 | 2198 | 2296 |     501 |\n| Time (wall clock) (μs) \\*  | 1883 | 1945 | 1962 | 1982 | 2032 | 2198 | 2294 |     501 |\n\n### Fixture/twitter.json/Parse/YYJSON\n\n| Metric                     |   p0 |  p25 |  p50 |  p75 |  p90 |  p99 | p100 | Samples |\n| :------------------------- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ------: |\n| Instructions (K) \\*        | 3509 | 3510 | 3510 | 3510 | 3510 | 3527 | 3941 |    6785 |\n| Malloc (total) \\*          |    3 |    3 |    3 |    3 |    3 |    3 |    3 |    6785 |\n| Memory (resident peak) (M) |   17 |   19 |   19 |   19 |   19 |   19 |   19 |    6785 |\n| Throughput (# / s) (#)     | 8544 | 8179 | 7791 | 7399 | 7267 | 6687 | 2383 |    6785 |\n| Time (total CPU) (μs) \\*   |  118 |  124 |  130 |  137 |  139 |  152 |  339 |    6785 |\n| Time (wall clock) (μs) \\*  |  117 |  122 |  128 |  135 |  138 |  150 |  420 |    6785 |\n\n### Fixture/tokenizer.json/Parse/Foundation\n\n| Metric                     |    p0 |   p25 |   p50 |   p75 |   p90 |   p99 |  p100 | Samples |\n| :------------------------- | ----: | ----: | ----: | ----: | ----: | ----: | ----: | ------: |\n| Instructions (M) \\*        |  1212 |  1213 |  1213 |  1213 |  1213 |  1215 |  1215 |      18 |\n| Malloc (total) (K) \\*      |   382 |   382 |   382 |   382 |   382 |   382 |   382 |      18 |\n| Memory (resident peak) (M) |    74 |   158 |   242 |   344 |   407 |   430 |   430 |      18 |\n| Throughput (# / s) (#)     |    18 |    18 |    17 |    17 |    17 |    17 |    17 |      18 |\n| Time (total CPU) (μs) \\*   | 54226 | 56001 | 56984 | 57541 | 58950 | 59070 | 59070 |      18 |\n| Time (wall clock) (μs) \\*  | 54202 | 56001 | 56951 | 57541 | 58917 | 59050 | 59050 |      18 |\n\n### Fixture/tokenizer.json/Parse/YYJSON\n\n| Metric                     |   p0 |  p25 |  p50 |  p75 |  p90 |  p99 | p100 | Samples |\n| :------------------------- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ------: |\n| Instructions (M) \\*        |  105 |  105 |  105 |  106 |  106 |  106 |  106 |     153 |\n| Malloc (total) \\*          |    4 |    4 |    4 |    4 |    4 |    4 |    4 |     153 |\n| Memory (resident peak) (M) |   28 |   52 |   52 |   52 |   52 |   52 |   52 |     153 |\n| Throughput (# / s) (#)     |  158 |  154 |  153 |  153 |  152 |  147 |  127 |     153 |\n| Time (total CPU) (μs) \\*   | 6316 | 6480 | 6525 | 6562 | 6607 | 6754 | 7863 |     153 |\n| Time (wall clock) (μs) \\*  | 6315 | 6476 | 6521 | 6554 | 6599 | 6816 | 7857 |     153 |\n\n\u003c/details\u003e\n\n## Requirements\n\n- Swift 6.1+ / Xcode 16+\n- macOS 10.15+ / iOS 13+ / tvOS 13+ / watchOS 6+ / visionOS 1+\n\n## Installation\n\n### Swift Package Manager\n\nAdd the following to your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/mattt/swift-yyjson.git\", from: \"0.3.0\")\n]\n```\n\n## Usage\n\n### Decoding with Codable\n\nUse `YYJSONDecoder` as an alternative to `JSONDecoder`:\n\n```swift\nimport YYJSON\n\nstruct User: Codable {\n    let id: Int\n    let name: String\n    let email: String\n}\n\nlet json = #\"{\"id\": 1, \"name\": \"Alice\", \"email\": \"alice@example.com\"}\"#\nlet data = json.data(using: .utf8)!\n\nlet decoder = YYJSONDecoder()\nlet user = try decoder.decode(User.self, from: data)\nprint(user.name) // \"Alice\"\n```\n\n`YYJSONDecoder` supports the same decoding strategies as `JSONDecoder`:\n\n```swift\nlet decoder = YYJSONDecoder()\ndecoder.keyDecodingStrategy = .convertFromSnakeCase\ndecoder.dateDecodingStrategy = .iso8601\ndecoder.dataDecodingStrategy = .base64\n```\n\n### JSON5 Support\n\nEnable JSON5 parsing for more flexible input:\n\n```swift\nlet decoder = YYJSONDecoder()\ndecoder.allowsJSON5 = true  // Enable all JSON5 features\n```\n\nOr configure individual JSON5 features:\n\n```swift\ndecoder.allowsJSON5 = .init(\n    trailingCommas: true,   // Allow [1, 2, 3,]\n    comments: true,         // Allow // and /* */ comments\n    infAndNaN: true,        // Allow Infinity and NaN literals\n    singleQuotedStrings: true  // Allow 'single quotes'\n)\n```\n\n\u003e [!NOTE]\n\u003e JSON5 support is unavailable when the `strictStandardJSON` trait is enabled.\n\u003e The `allowsJSON5` property and `JSON5DecodingOptions` type are conditionally compiled\n\u003e and will not be available at compile time.\n\n### Encoding with Codable\n\nUse `YYJSONEncoder` as an alternative to `JSONEncoder`:\n\n```swift\nimport YYJSON\n\nlet user = User(id: 1, name: \"Alice\", email: \"alice@example.com\")\n\nlet encoder = YYJSONEncoder()\nlet data = try encoder.encode(user)\nprint(String(data: data, encoding: .utf8)!)\n// {\"id\":1,\"name\":\"Alice\",\"email\":\"alice@example.com\"}\n```\n\nConfigure output formatting:\n\n```swift\nvar encoder = YYJSONEncoder()\nencoder.writeOptions = [.prettyPrinted, .escapeUnicode]\n```\n\n`YYJSONEncoder` supports date encoding strategies:\n\n```swift\nvar encoder = YYJSONEncoder()\nencoder.dateEncodingStrategy = .iso8601\n// Or: .secondsSince1970, .millisecondsSince1970, .formatted(formatter), .custom(closure)\n```\n\n### DOM-Style Access\n\nParse JSON and access values directly without defining types:\n\n```swift\nimport YYJSON\n\nlet json = #\"{\"users\": [{\"name\": \"Alice\"}, {\"name\": \"Bob\"}]}\"#\nlet value = try YYJSONValue(string: json)\n\n// Access nested values with subscripts\nif let name = value[\"users\"]?[0]?[\"name\"]?.string {\n    print(name) // \"Alice\"\n}\n```\n\n### In-Place Parsing\n\nFor maximum performance with large JSON files,\nuse in-place parsing to avoid copying the input data:\n\n```swift\nvar data = try Data(contentsOf: fileURL)\nlet json = try YYJSONValue.parseInPlace(consuming: \u0026data)\n// `data` is now consumed and should not be used\n```\n\nIn-place parsing allows yyjson to parse directly within the input buffer,\navoiding memory allocation for string storage.\nThe `inout` parameter makes it clear that the data is consumed by this operation.\n\n\u003e [!NOTE]\n\u003e For most use cases, the standard `YYJSONValue(data:)` initializer is sufficient.\n\u003e Use in-place parsing only when performance is critical\n\u003e and you can accept the ownership semantics.\n\n### JSONSerialization Alternative\n\nUse `YYJSONSerialization` with the same API as Foundation's `JSONSerialization`:\n\n```swift\nimport YYJSON\n\nlet json = #\"{\"message\": \"Hello, World!\"}\"#\nlet data = json.data(using: .utf8)!\n\nlet object = try YYJSONSerialization.jsonObject(with: data)\nif let dict = object as? [String: Any] {\n    print(dict[\"message\"] as? String ?? \"\") // \"Hello, World!\"\n}\n```\n\nConfigure output formatting with `WritingOptions`:\n\n```swift\n// Pretty printing with 2-space indent (useful for Xcode asset catalogs)\nlet data = try YYJSONSerialization.data(\n    withJSONObject: dict,\n    options: [.indentationTwoSpaces, .sortedKeys]\n)\n\n// ASCII-only output with trailing newline\nlet data = try YYJSONSerialization.data(\n    withJSONObject: dict,\n    options: [.escapeUnicode, .newlineAtEnd]\n)\n```\n\nAvailable writing options:\n\n- `.fragmentsAllowed` — Allow top-level values that aren't arrays or dictionaries\n- `.prettyPrinted` — Pretty print with 4-space indent\n- `.sortedKeys` — Sort dictionary keys lexicographically\n- `.withoutEscapingSlashes` — Don't escape `/` as `\\/`\n- `.indentationTwoSpaces` — Configure pretty printing to use 2-space indent (implies `.prettyPrinted`)\n- `.escapeUnicode` — Escape non-ASCII characters as `\\uXXXX`\n- `.newlineAtEnd` — Add trailing newline `\\n`\n\nNon-standard options (unavailable when `strictStandardJSON` trait is enabled):\n\n- `.allowInfAndNaN` — Write `Infinity` and `NaN` literals\n- `.infAndNaNAsNull` — Write `Infinity` and `NaN` as `null` (takes precedence)\n\n## Read and Write Options\n\n### Reading Options\n\nConfigure parsing behavior with `YYJSONReadOptions`:\n\n```swift\nlet value = try YYJSONValue(data: data, options: [.allowComments, .allowTrailingCommas])\n```\n\nAvailable options:\n\n- `.stopWhenDone` — Stop after first complete JSON document\n- `.numberAsRaw` — Read all numbers as raw strings\n- `.allowInvalidUnicode` — Allow reading invalid unicode\n- `.bigNumberAsRaw` — Read big numbers as raw strings\n\nNon-standard options (unavailable when `strictStandardJSON` trait is enabled):\n\n- `.allowTrailingCommas` — Allow `[1, 2, 3,]`\n- `.allowComments` — Allow `//` and `/* */` comments\n- `.allowInfAndNaN` — Allow `Infinity`, `-Infinity`, `NaN`\n- `.allowBOM` — Allow UTF-8 BOM\n- `.allowExtendedNumbers` — Allow hex, leading `.`, trailing `.`, leading `+`\n- `.allowExtendedEscapes` — Allow `\\a`, `\\e`, `\\v`, `\\xNN`, etc.\n- `.allowExtendedWhitespace` — Allow extended whitespace characters\n- `.allowSingleQuotedStrings` — Allow `'single quotes'`\n- `.allowUnquotedKeys` — Allow `{key: value}`\n- `.json5` — Enable all JSON5 features\n\n### Writing Options\n\nConfigure output with `YYJSONWriteOptions`:\n\n```swift\nvar encoder = YYJSONEncoder()\nencoder.writeOptions = [.prettyPrinted, .escapeSlashes]\n```\n\nAvailable options:\n\n- `.prettyPrinted` — Pretty print with 4-space indent\n- `.indentationTwoSpaces` — Pretty print with 2-space indent (implies `.prettyPrinted`)\n- `.escapeUnicode` — Escape non-ASCII as `\\uXXXX`\n- `.escapeSlashes` — Escape `/` as `\\/`\n- `.allowInvalidUnicode` — Allow invalid unicode when encoding\n- `.newlineAtEnd` — Add trailing newline\n- `.sortedKeys` — Sort object keys lexicographically\n\nNon-standard options (unavailable when `strictStandardJSON` trait is enabled):\n\n- `.allowInfAndNaN` — Write `Infinity` and `NaN` literals\n- `.infAndNaNAsNull` — Write `Infinity` and `NaN` as `null` (takes precedence)\n\n## Package Traits\n\nCustomize the underlying yyjson library at compile time using package traits:\n\n```swift\n.package(\n    url: \"https://github.com/mattt/swift-yyjson.git\",\n    from: \"0.3.0\",\n    traits: [\"noWriter\", \"strictStandardJSON\"]\n)\n```\n\nBy default, no traits are enabled —\nyou get full functionality with all features and validations included.\nEnable traits only when you have specific size or performance requirements.\n\n\u003e [!NOTE]\n\u003e When traits are enabled,\n\u003e the corresponding Swift APIs are conditionally compiled\n\u003e and become unavailable at compile time.\n\u003e For example, enabling the `noReader` trait makes unavailable\n\u003e `YYJSONDecoder`, `YYJSONValue`, and `YYJSONSerialization.jsonObject(with:options:)`.\n\u003e Similarly, enabling the `noWriter` trait makes unavailable\n\u003e `YYJSONEncoder` and `YYJSONSerialization.data(withJSONObject:options:)`.\n\n### `noReader`\n\nDisables JSON reader functionality at compile-time\n(functions with \"read\" in their name).\n**Reduces binary size by about 60%.**\nUse this if your application only needs to write JSON, not parse it.\n\nWhen this trait is enabled, the following APIs become unavailable:\n\n- `YYJSONDecoder`\n- `YYJSONValue`, `YYJSONObject`, `YYJSONArray`\n- `YYJSONSerialization.jsonObject(with:options:)`\n\n### `noWriter`\n\nDisables JSON writer functionality at compile-time\n(functions with \"write\" in their name).\n**Reduces binary size by about 30%.**\nUse this if your application only needs to parse JSON, not generate it.\n\nWhen this trait is enabled, the following APIs become unavailable:\n\n- `YYJSONEncoder`\n- `YYJSONSerialization.data(withJSONObject:options:)`\n\n### `noIncrementalReader`\n\nDisables the incremental JSON reader at compile-time.\nUse this if you don't need to parse JSON in streaming/chunked mode.\n\n### `noUtilities`\n\nDisables support for\n[JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901),\n[JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902/), and\n[JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386).\nUse this if you don't need these utilities for querying or modifying JSON documents.\n\n### `noFastFloatingPoint`\n\nDisables yyjson's fast floating-point number conversion\nand uses libc's `strtod`/`snprintf` instead.\n**Reduces binary size by about 30%, but significantly slows down floating-point read/write speed.**\nUse this only if binary size is critical\nand you don't process many floating-point values.\n\n### `strictStandardJSON`\n\nDisables non-standard JSON features at compile-time\n(such as allowing comments, trailing commas, or infinity/NaN values).\n**Reduces binary size by about 10% and slightly improves performance.**\nUse this if you only need to handle strictly conformant JSON.\n\nWhen this trait is enabled, the following APIs become unavailable:\n\n- `YYJSONReadOptions.allowTrailingCommas`\n- `YYJSONReadOptions.allowComments`\n- `YYJSONReadOptions.allowInfAndNaN`\n- `YYJSONReadOptions.allowBOM`\n- `YYJSONReadOptions.allowExtendedNumbers`\n- `YYJSONReadOptions.allowExtendedEscapes`\n- `YYJSONReadOptions.allowExtendedWhitespace`\n- `YYJSONReadOptions.allowSingleQuotedStrings`\n- `YYJSONReadOptions.allowUnquotedKeys`\n- `YYJSONReadOptions.json5`\n- `YYJSONWriteOptions.allowInfAndNaN`\n- `YYJSONWriteOptions.infAndNaNAsNull`\n- `YYJSONDecoder.allowsJSON5`\n- `JSON5DecodingOptions`\n- `YYJSONSerialization.ReadingOptions.json5Allowed`\n\n### `noUTF8Validation`\n\nDisables UTF-8 validation at compile-time.\n**Improves performance for non-ASCII strings by about 3% to 7%.**\nUse this only if all input strings are guaranteed to be valid UTF-8.\n\n\u003e [!CAUTION]\n\u003e If this trait is enabled while passing invalid UTF-8 data,\n\u003e parsing errors may be silently ignored,\n\u003e strings may merge unexpectedly,\n\u003e or out-of-bounds memory access may occur.\n\n## Differences from Foundation\n\n`YYJSONDecoder` and `YYJSONEncoder` are designed to be API-compatible with\nFoundation's `JSONDecoder` and `JSONEncoder` for common use cases.\nHowever, there are some differences:\n\n- **Error types**: Throws `YYJSONError` instead of `DecodingError`/`EncodingError`.\n  `YYJSONSerialization` also throws `YYJSONError` rather than `NSError`.\n- **Encoder strategies**: `YYJSONEncoder` does not yet support\n  `keyEncodingStrategy` or `nonConformingFloatEncodingStrategy`\n\n- **Output formatting**: Uses `writeOptions` instead of `outputFormatting`\n- **Number precision**: yyjson parses numbers as 64-bit integers or doubles;\n  extremely large integers may lose precision\n\n## Thread Safety\n\n- `YYJSONDecoder` and `YYJSONEncoder` are value types and safe to use from\n  multiple threads, as long as each `encode`/`decode` call is not shared concurrently.\n- `YYJSONValue`, `YYJSONObject`, and `YYJSONArray` are safe to share across threads\n  for read-only access; they wrap an immutable yyjson document.\n- The `number` property on `YYJSONValue` returns a `Double`. For exact representation\n  of very large numbers, parse using `.bigNumberAsRaw` and read them as strings.\n\n## License\n\nThis project is available under the MIT license.\nSee the LICENSE file for more info.\n\nThe underlying [yyjson](https://github.com/ibireme/yyjson) library\nis also available under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattt%2Fswift-yyjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattt%2Fswift-yyjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattt%2Fswift-yyjson/lists"}