Skip to content

Instantly share code, notes, and snippets.

View ColGren's full-sized avatar

Col Grenfell ColGren

View GitHub Profile
@LeeKahSeng
LeeKahSeng / Decode-Dynamic-Keys-JSON-Final.swift
Last active June 4, 2023 14:04
Decode and Flatten JSON with Dynamic Keys Using Swift Decodable (https://swiftsenpai.com/swift/decode-dynamic-keys-json/)
import Foundation
let jsonString = """
{
"S001": {
"firstName": "Tony",
"lastName": "Stark"
},
"S002": {
"firstName": "Peter",