Skip to content

Decoding error when saving nested object #157

Closed
@ribotinho

Description

@ribotinho

Hi all,

I am encountering an issue when saving a nested object.

I have a teacher object that has a name (string) and a language (custom object)

struct teacher : ParseObject {
    
    var objectId: String?
    var createdAt: Date?
    var updatedAt: Date?
    var ACL: ParseACL?
    
    var name : String
    var langauge : language
}
struct language : ParseObject{
    var objectId: String?
    var createdAt: Date?
    var updatedAt: Date?
    var ACL: ParseACL?
    
    var code : String
}

I have no problem creating and saving language objects, but when I try to save a Teacher object I am getting a decoding error:

ParseError(code: ParseSwift.ParseError.Code.unknownError, message: "decoding error: typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array but found a dictionary instead.", underlyingError: nil))")

I am running the parse server on a localhost. macOS Big Sur and SwiftUI.

I have also tried saving the example of Author and Book in the Swift Playgrounds example code but I am getting exactly the same output.

Any one would know how can I solve this? Or what I am missing?

Kind regards,
Pau

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions