on 02-26-2019 11:25 AM
I am trying to JSON encode and decode an EntityValueList that is the result of executing a query (QueryResult.entityList).
let encodedData = try JSONEncoder().encode(list) // Works!
let JSONString = String(data: encodedData, encoding: .utf8) // Works!
print(JSONString) // Works! - prints out the objects
let decoder = JSONDecoder()
decoder.userInfo[CSDLDocument.csdlInfoKey] = MyAppMetadata.document
let equipmentList = try decoder.decode(EntityValueList.self, from: encodedData) // Fails!
The error is that @entityType' key is missing but I can verify, using the above JSONString, that each
object in the JSON is the right entityType and that it has an '@EntityType' property.
Are there hidden properties or similar that are omitted when encoding or decoding - or even better, is there a different approach to create EntitValues from a JSON file?
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.