Post

Replies

Boosts

Views

Activity

Comment on "The given data was not valid JSON."
I send a request in this structure for getting data on the server as I typed before struct Response: Encodable, Decodable {         var data: UserData     }     struct UserData: Codable {         var date: String         var type: String         private enum CodingKeys: String, CodingKey {             case date = "date"             case type = "type"         }     } { "data":{ "date":"07-03-2022", "type":"airplane"  } } it says Error: could not handle the request in the server side and given data is not valid json on my side, this is an interpretation it might be something wrong with the method, it should be hitp pure method with specific headers I think
Mar ’22
Comment on "The given data was not valid JSON."
I get nothing just the warning that says the given data was not valid json, dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around line 1, column 0." UserInfo={NSDebugDescription=Invalid value around line 1, column 0., NSJSONSerializationErrorIndex=0}))) knowing that I am getting data from cloud function(firebase) to swiftui ? does this method work ? for example "https://us-central1-example-0f000.cloudfunctions.net/getEvent"
Mar ’22