Hi, my Json file looks like that:
{"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"]]}
Ps: i deleted the arrays from 2 to 15. its nearly all the same.
and thats my load function:
func load(){//fileName: String) {
if let filemanger = Bundle.main.url(forResource: "Synapses", withExtension: "json"){
do{
let data = try Foundation.Data(contentsOf: filemanger)
let jsondecoder = JSONDecoder()
let datafromjson = try jsondecoder.decode([SynapsData].self, from: data)
self.Data = datafromjson
}catch{
print("fuck ey so ne scheisse\(error)")
}
}
}
struct SynapsData: Codable {
var ID : Int
var SynapsX : CGFloat
var SynapsY : CGFloat
var SynapsWidth : CGFloat
var SynapsHeight : CGFloat
}
And my Output is just []. I just don't see the problem 😅.