your json is not equal to your construct.
this Json
{"Synapses": [["ID: 0", "XPosition: 387.8125", "YPosition: 502.96875", "Width: 187.375", "Height: 122.0625"],["ID: 16", "XPosition: 490.859375", "YPosition: 947.15625", "Width: 49.28125", "Height: 69.6875"]]}
is equal to the following construct
struct NAME: Codable {
let synapses: [[String]]
enum CodingKeys: String, CodingKey {
case synapses = "Synapses"
}
}
in order to match your json to this construct
// MARK: - Synapse
struct Synapse: Codable {
let id: Int
let synapsX, synapsY, synapsWidth, synapsHeight: Double
enum CodingKeys: String, CodingKey {
case id = "ID"
case synapsX = "SynapsX"
case synapsY = "SynapsY"
case synapsWidth = "SynapsWidth"
case synapsHeight = "SynapsHeight"
}
}
the json should be like
{
"Synapses": [
{
"ID": 0,
"SynapsX": 387.8125,
"SynapsY": 502.96875,
"SynapsWidth": 187.375,
"SynapsHeight": 122.0625
},
{
"ID": 16,
"SynapsX": 490.859375,
"SynapsY": 947.15625,
"SynapsWidth": 49.28125,
"SynapsHeight": 69.6875
}
]
}
Summery: your json did not match your construct from many point of views
Topic:
App & System Services
SubTopic:
General
Tags: