# \#json

**URL:** https://forums.swift.org/tag/json/42.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Introducing Swift-JSON 1.0.0: exact JSON values, offline schemas and bounded streams](https://forums.swift.org/t/introducing-swift-json-1-0-0-exact-json-values-offline-schemas-and-bounded-streams/90006)

<div class="topic-metadata">

**Author:** [@ThorFuchs](https://forums.swift.org/u/ThorFuchs)\
**Replies:** 0\
**Last updated:** [October 11, 2026, 5:18pm UTC](https://forums.swift.org/t/introducing-swift-json-1-0-0-exact-json-values-offline-schemas-and-bounded-streams/90006 "2026-10-11T17:18:42Z")

</div>

Hi everyone, I’ve released Swift-JSON 1.0.0, an Apache-2.0 package for applications where numeric precision, Unicode identity and resource limits matter. A concrete example: 9007199254740993 remains distinct from 90071…

---

## [WASM-optimized JSON-parsing library (no Foundation)](https://forums.swift.org/t/wasm-optimized-json-parsing-library-no-foundation/88365)

<div class="topic-metadata">

**Author:** [@vitamin](https://forums.swift.org/u/vitamin)\
**Replies:** 0\
**Last updated:** [July 18, 2026, 4:49pm UTC](https://forums.swift.org/t/wasm-optimized-json-parsing-library-no-foundation/88365 "2026-07-18T16:49:18Z")

</div>

.o size: 154 kb .a size: 360 kb 1.4x faster than Foundation parser 169mb/s serialization in my testing Base lib supports Embedded Swift as of FTT version 2.0.0 Size with Codable support added is +56kb/+275kb (Codabl…

---

## [Swift-json-schema: An Efficient Codable Alternative](https://forums.swift.org/t/swift-json-schema-an-efficient-codable-alternative/87268)

<div class="topic-metadata">

**Author:** [@Joannis\_Orlandos](https://forums.swift.org/u/Joannis_Orlandos)\
**Replies:** 0\
**Last updated:** [June 10, 2026, 1:05pm UTC](https://forums.swift.org/t/swift-json-schema-an-efficient-codable-alternative/87268 "2026-06-10T13:05:57Z")

</div>

I'd like to share swift-json-schema, a SwiftPM build tool plugin that generates Codable Swift types from .schema.json files (JSON Schema Draft 2020-12) at compile time - with an optional fast path that bypasses Codable e…

---

## [JSON field names customisation approaches](https://forums.swift.org/t/json-field-names-customisation-approaches/84811)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 1\
**Last updated:** [February 23, 2026, 3:51am UTC](https://forums.swift.org/t/json-field-names-customisation-approaches/84811 "2026-02-23T03:51:24Z")

</div>

Is there a macro, a property wrapper, or similar magic to customise JSON field names without introducing a wholesale CodingKeys? Something like: struct S: Codable { var a, b, c, ... many fields those are fine @j…

---

## [Swon: Swift Macros for Foundation-free JSON processing](https://forums.swift.org/t/swon-swift-macros-for-foundation-free-json-processing/83461)

<div class="topic-metadata">

**Author:** [@keeshux](https://forums.swift.org/u/keeshux)\
**Replies:** 0\
**Last updated:** [November 29, 2025, 12:09pm UTC](https://forums.swift.org/t/swon-swift-macros-for-foundation-free-json-processing/83461 "2025-11-29T12:09:26Z")

</div>

Hi, I wanted to present a repo that I've just published, and some may find useful: With the intent to drop the Foundation dependency from my cross-platform projects, and also as an exercise to practice Swift Macros, s…

---

## [\[Pitch\] JSONDecoder.nullDecodingStrategy](https://forums.swift.org/t/pitch-jsondecoder-nulldecodingstrategy/13980)

<div class="topic-metadata">

**Author:** [@Dan\_Stenmark](https://forums.swift.org/u/Dan_Stenmark)\
**Replies:** 19\
**Last updated:** [August 16, 2025, 7:58pm UTC](https://forums.swift.org/t/pitch-jsondecoder-nulldecodingstrategy/13980 "2025-08-16T19:58:38Z")

</div>

JSONDecoder currently does not differentiate between a payload containing an explicit null or the field being omitted. I would like to propose an additive change to include a decoding strategy for these situations: cla…

---

## [A mixture of date formats in JSON](https://forums.swift.org/t/a-mixture-of-date-formats-in-json/81613)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 7\
**Last updated:** [August 14, 2025, 10:04pm UTC](https://forums.swift.org/t/a-mixture-of-date-formats-in-json/81613 "2025-08-14T22:04:43Z")

</div>

I'm dealing with API that returns dates in a mixture of formats, with or without fractional seconds of various lengths and with or without Z. To parse it from JSON I'm doing: let decoder = JSONDecoder() let f1 = DateF…

---

## [Why does my JSON response fail to decode on iOS 15 but succeed on iOS 17?](https://forums.swift.org/t/why-does-my-json-response-fail-to-decode-on-ios-15-but-succeed-on-ios-17/77798)

<div class="topic-metadata">

**Author:** [@KrimpusChrome](https://forums.swift.org/u/KrimpusChrome)\
**Replies:** 16\
**Last updated:** [February 12, 2025, 2:37pm UTC](https://forums.swift.org/t/why-does-my-json-response-fail-to-decode-on-ios-15-but-succeed-on-ios-17/77798 "2025-02-12T14:37:51Z")

</div>

I am seeing an issue where the exact same JSON payload is failing to decode on my iPhone SE (iOS 15.7), but succeeding on my iPhone 15 Pro (iOS 17.6.1). I am using a default JSONDecoder with no extra configurations. On…

---

## [Low level JSON API (idea)](https://forums.swift.org/t/low-level-json-api-idea/71704)

<div class="topic-metadata">

**Author:** [@Stiivi](https://forums.swift.org/u/Stiivi)\
**Replies:** 2\
**Last updated:** [May 10, 2024, 1:38pm UTC](https://forums.swift.org/t/low-level-json-api-idea/71704 "2024-05-10T13:38:18Z")

</div>

SwiftFoundationEssentials contains JSON parsing/generating for JSON Codable encoder/decoder. There are situations where one would like to have a finer control over JSON. Original Foundation has JSONSerialization, however…

---

## [Blank menu with external json](https://forums.swift.org/t/blank-menu-with-external-json/69720)

<div class="topic-metadata">

**Author:** [@donnievedro](https://forums.swift.org/u/donnievedro)\
**Replies:** 3\
**Last updated:** [January 30, 2024, 9:31pm UTC](https://forums.swift.org/t/blank-menu-with-external-json/69720 "2024-01-30T21:31:40Z")

</div>

Hello everyone, I'm trying to create an iOS app with Swift for the first time and I've encountered an error that I can't solve. I've searched and googled a lot but somehow I can't find anything. So, the app displays ci…

---

## [JSON decoding failing for only one field](https://forums.swift.org/t/json-decoding-failing-for-only-one-field/68596)

<div class="topic-metadata">

**Author:** [@kbartlett](https://forums.swift.org/u/kbartlett)\
**Replies:** 7\
**Last updated:** [November 27, 2023, 2:57pm UTC](https://forums.swift.org/t/json-decoding-failing-for-only-one-field/68596 "2023-11-27T14:57:31Z")

</div>

I have JSON data, where the structure looks like this: { "name": "Abaddon", "inherits": "Curse", "item": "Megaton Raid Belt", "itemr": "God's Hand Belt", "level": 75, "arc…

---

## [JSON and "\\u{FEFF}": unexpected behavior](https://forums.swift.org/t/json-and-u-feff-unexpected-behavior/67993)

<div class="topic-metadata">

**Author:** [@kts](https://forums.swift.org/u/kts)\
**Replies:** 9\
**Last updated:** [October 25, 2023, 11:19am UTC](https://forums.swift.org/t/json-and-u-feff-unexpected-behavior/67993 "2023-10-25T11:19:27Z")

</div>

I have a JSON file consisting of these eight bytes (including quotes): "\\ufeff". Reading with JSONSerialization results in an empty string (program below). Note this isn't a byte-order-mark at the start of the file, but …

---

## [Wouldn't JSONPatch, JSONPointer be better in Foundation?](https://forums.swift.org/t/wouldnt-jsonpatch-jsonpointer-be-better-in-foundation/67109)

<div class="topic-metadata">

**Author:** [@camunro](https://forums.swift.org/u/camunro)\
**Replies:** 8\
**Last updated:** [September 7, 2023, 10:35am UTC](https://forums.swift.org/t/wouldnt-jsonpatch-jsonpointer-be-better-in-foundation/67109 "2023-09-07T10:35:15Z")

</div>

Upon looking for third party library for the IETF standards for JSONPatch and JSONPointer I stumbled across DocC having those capabilities. Sources/SwiftDocC/Model/Rendering/Variants/ JSONPatchApplier.swift JSONPatchO…

---

## [Introducing JSONParsing: A library for writing bidirectional JSON parsers](https://forums.swift.org/t/introducing-jsonparsing-a-library-for-writing-bidirectional-json-parsers/66194)

<div class="topic-metadata">

**Author:** [@Oskar\_Ek](https://forums.swift.org/u/Oskar_Ek)\
**Replies:** 0\
**Last updated:** [July 17, 2023, 7:50am UTC](https://forums.swift.org/t/introducing-jsonparsing-a-library-for-writing-bidirectional-json-parsers/66194 "2023-07-17T07:50:46Z")

</div>

Hi :wave: I'd like to introduce JSONParsing - a library for decoding and encoding JSON, built on top of Parsing. This library provides an alternative approach for dealing with JSON to the default way in Swift, which is…

---

## [Javascript Object native swift type equivalent , JavascriptCore bridging](https://forums.swift.org/t/javascript-object-native-swift-type-equivalent-javascriptcore-bridging/65522)

<div class="topic-metadata">

**Author:** [@benjamin.g](https://forums.swift.org/u/benjamin.g)\
**Replies:** 2\
**Last updated:** [June 12, 2023, 4:12pm UTC](https://forums.swift.org/t/javascript-object-native-swift-type-equivalent-javascriptcore-bridging/65522 "2023-06-12T16:12:10Z")

</div>

Hi, i'm currently working with JavascriptCore framework and the bridging with Swift objects. This framework currently exposes a few bridging methods, but one very quickly hit a wall as there's no equivalent to "json rep…

---

## [Persisting unknown fields in JSON with Codable](https://forums.swift.org/t/persisting-unknown-fields-in-json-with-codable/63445)

<div class="topic-metadata">

**Author:** [@memes](https://forums.swift.org/u/memes)\
**Replies:** 4\
**Last updated:** [March 3, 2023, 1:57am UTC](https://forums.swift.org/t/persisting-unknown-fields-in-json-with-codable/63445 "2023-03-03T01:57:23Z")

</div>

I'm writing an editor that stores projects as JSON. I've defined Codable models for all the known fields but sometimes the project contains unknown fields that are being lost at the decode step. I was thinking of adding …

---

## [Deserialize items in JSON array to different types(parameterized enum) based on fields](https://forums.swift.org/t/deserialize-items-in-json-array-to-different-types-parameterized-enum-based-on-fields/63406)

<div class="topic-metadata">

**Author:** [@canrapwillcode](https://forums.swift.org/u/canrapwillcode)\
**Replies:** 1\
**Last updated:** [February 28, 2023, 4:11am UTC](https://forums.swift.org/t/deserialize-items-in-json-array-to-different-types-parameterized-enum-based-on-fields/63406 "2023-02-28T04:11:05Z")

</div>

I am trying to deserialize a json like so { "timestamp": 123456789, "ownerAssets" : \[ { "ownerId" : 123, "location" : "USA", "assets" : \[ { "car" : true, "make" : "honda", "model" : "crv"…

---

## [\[Pitch\] JSON Encoding Int64 as String](https://forums.swift.org/t/pitch-json-encoding-int64-as-string/38009)

<div class="topic-metadata">

**Author:** [@efirestone](https://forums.swift.org/u/efirestone)\
**Replies:** 9\
**Last updated:** [February 15, 2023, 10:37pm UTC](https://forums.swift.org/t/pitch-json-encoding-int64-as-string/38009 "2023-02-15T22:37:00Z")

</div>

JSONEncoder encodes Int64 and UInt64 values as numbers (no quotes), but this is incompatible with JavaScript as JavaScript only supports integer values up to 53-bits long. This means that iOS-generated JSON is incompatib…

---

## [How to return native type via \`type(of:)\` from JSON string](https://forums.swift.org/t/how-to-return-native-type-via-type-of-from-json-string/62223)

<div class="topic-metadata">

**Author:** [@wrmorgue](https://forums.swift.org/u/wrmorgue)\
**Replies:** 7\
**Last updated:** [December 27, 2022, 9:04pm UTC](https://forums.swift.org/t/how-to-return-native-type-via-type-of-from-json-string/62223 "2022-12-27T21:04:21Z")

</div>

I'm trying to print a data type for a JSON string, but I get non-native types: func printJSONTypes(jsonString: String) { // First, try to parse the JSON string into an object guard let jsonObject = try? JSONSeriali…

---

## [How to decode JSON returning an array of arrays of different types](https://forums.swift.org/t/how-to-decode-json-returning-an-array-of-arrays-of-different-types/61373)

<div class="topic-metadata">

**Author:** [@libhut-samwes](https://forums.swift.org/u/libhut-samwes)\
**Replies:** 0\
**Last updated:** [November 11, 2022, 8:14am UTC](https://forums.swift.org/t/how-to-decode-json-returning-an-array-of-arrays-of-different-types/61373 "2022-11-11T08:14:06Z")

</div>

I am trying to get JSON from an external source, using AlamoFire tools. Using the .responseJSON method works, but that will be deprecated and in any case I know .responseDecodable is more sound. However, I cannot figur…

---

## [How to decode a JSON String which uses Integer values as Boolean, alternatively can I force SQLite to use true/false instead of 1/0 as Bool](https://forums.swift.org/t/how-to-decode-a-json-string-which-uses-integer-values-as-boolean-alternatively-can-i-force-sqlite-to-use-true-false-instead-of-1-0-as-bool/60925)

<div class="topic-metadata">

**Author:** [@mrtksn](https://forums.swift.org/u/mrtksn)\
**Replies:** 8\
**Last updated:** [October 20, 2022, 4:22am UTC](https://forums.swift.org/t/how-to-decode-a-json-string-which-uses-integer-values-as-boolean-alternatively-can-i-force-sqlite-to-use-true-false-instead-of-1-0-as-bool/60925 "2022-10-20T04:22:21Z")

</div>

I'm using SQLite with Swift to store some JSON in a table column. I convert a Codable object into a JSON String and store it in the "json" column in my "data" table. id name json 1 item1 {"status" : true} 2 it…

---

## [HTTP Status 400 – Bad Request](https://forums.swift.org/t/http-status-400-bad-request/59690)

<div class="topic-metadata">

**Author:** [@Scorean](https://forums.swift.org/u/Scorean)\
**Replies:** 1\
**Last updated:** [August 17, 2022, 9:22am UTC](https://forums.swift.org/t/http-status-400-bad-request/59690 "2022-08-17T09:22:10Z")

</div>

I'm making a POST function but I'm getting an error. I am getting "HTTP Status 400 – Bad Request" error in console. In the simulator, it says "Something went wrong. Please try again later" on the screen. I don't understa…

---

## [Cleaner Way to Decode Missing JSON Keys?](https://forums.swift.org/t/cleaner-way-to-decode-missing-json-keys/40523)

<div class="topic-metadata">

**Author:** [@xanderdunn](https://forums.swift.org/u/xanderdunn)\
**Replies:** 8\
**Last updated:** [July 19, 2022, 2:38pm UTC](https://forums.swift.org/t/cleaner-way-to-decode-missing-json-keys/40523 "2022-07-19T14:38:21Z")

</div>

I have a Codable class that looks like this: import Foundation struct MyClass: Decodable { let name: String let time: Date let sometimesPresent1: Double? let sometimesPresent2: Double? let sometimes…

---

## [Xcode keeps giving me the error "Expected to decode Array\<Any\> but found a dictionary instead"](https://forums.swift.org/t/xcode-keeps-giving-me-the-error-expected-to-decode-array-any-but-found-a-dictionary-instead/58415)

<div class="topic-metadata">

**Author:** [@Scorean](https://forums.swift.org/u/Scorean)\
**Replies:** 3\
**Last updated:** [June 24, 2022, 7:48am UTC](https://forums.swift.org/t/xcode-keeps-giving-me-the-error-expected-to-decode-array-any-but-found-a-dictionary-instead/58415 "2022-06-24T07:48:08Z")

</div>

I want to print the information of the login user on the screen, but I fail typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: , debugDescription: "Expected to decode Array but found a dictionary inste…

---

## [Expected to decode Array\<Any\> but found a dictionary instead](https://forums.swift.org/t/expected-to-decode-array-any-but-found-a-dictionary-instead/57268)

<div class="topic-metadata">

**Author:** [@Googler](https://forums.swift.org/u/Googler)\
**Replies:** 5\
**Last updated:** [May 12, 2022, 2:55pm UTC](https://forums.swift.org/t/expected-to-decode-array-any-but-found-a-dictionary-instead/57268 "2022-05-12T14:55:24Z")

</div>

Hello everyone! I've been scouring the internet and yes I have read the many threads on here with this exact scenario and all of the wonderful solutions. However none have worked for my particular application. Here is th…

---

## [JSON date format flavours support](https://forums.swift.org/t/json-date-format-flavours-support/56625)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 4\
**Last updated:** [April 11, 2022, 7:39am UTC](https://forums.swift.org/t/json-date-format-flavours-support/56625 "2022-04-11T07:39:18Z")

</div>

I have to work with backend that can return multiple flavours of iso8601 date format (and some other flavours as well). As far as I know iso8601 DateDecodingStrategy is very peculiar about format. Doing this custom strat…

---

## [New release: swift-json now supports swift 5.3–5.5, iOS, tvOS, and watchOS!](https://forums.swift.org/t/new-release-swift-json-now-supports-swift-5-3-5-5-ios-tvos-and-watchos/55644)

<div class="topic-metadata">

**Author:** [@taylorswift](https://forums.swift.org/u/taylorswift)\
**Replies:** 3\
**Last updated:** [April 8, 2022, 9:50pm UTC](https://forums.swift.org/t/new-release-swift-json-now-supports-swift-5-3-5-5-ios-tvos-and-watchos/55644 "2022-04-08T21:50:12Z")

</div>

json 0.2.0 hi all, about a month ago, we released the experimental swift-json v0.1.0. swift-json up to v0.1.6 only compiles on the swift 5.6 nightlies, and contains executable test targets that only compile on linux…

---

## [Most convenient use of hex encoded strings in json?](https://forums.swift.org/t/most-convenient-use-of-hex-encoded-strings-in-json/47576)

<div class="topic-metadata">

**Author:** [@mickeyl](https://forums.swift.org/u/mickeyl)\
**Replies:** 5\
**Last updated:** [March 18, 2022, 8:52am UTC](https://forums.swift.org/t/most-convenient-use-of-hex-encoded-strings-in-json/47576 "2022-03-18T08:52:36Z")

</div>

I need to parse a json format where many fields contain values of base types, such as uint8, uint16, uint32, and \[uint8\] – encoded as 0x-prefixed hex-strings, since for those who work on the input fields, they usually de…

---

## [JSON Encoding / Decoding weird encoding of dictionary with enum values](https://forums.swift.org/t/json-encoding-decoding-weird-encoding-of-dictionary-with-enum-values/12995)

<div class="topic-metadata">

**Author:** [@zarghol](https://forums.swift.org/u/zarghol)\
**Replies:** 11\
**Last updated:** [March 15, 2022, 9:44am UTC](https://forums.swift.org/t/json-encoding-decoding-weird-encoding-of-dictionary-with-enum-values/12995 "2022-03-15T09:44:49Z")

</div>

Hi ! I use json format to store datas, but I am facing a weird behavior with my struct : let encoder = JSONEncoder() encoder.outputFormatting = .prettyPrinted enum Characteristic: String, Codable { case charac1 } …

---

## [How to decode JSON object, which contains different keys?](https://forums.swift.org/t/how-to-decode-json-object-which-contains-different-keys/55440)

<div class="topic-metadata">

**Author:** [@Abrc](https://forums.swift.org/u/Abrc)\
**Replies:** 3\
**Last updated:** [February 20, 2022, 4:35am UTC](https://forums.swift.org/t/how-to-decode-json-object-which-contains-different-keys/55440 "2022-02-20T04:35:00Z")

</div>

I have json response like this and server returns different keys for "prices" and in sometimes "prices" may be false { "id": 194, "name": "Apple iPhone 11 128GB Black", "prices": { "100": "23500", "2…

[Next page](https://forums.swift.org/tag/json/42.md?match_all_tags=true&page=1&tags%5B%5D=json)
