diff --git a/Sources/NeiSwift/Protocol/NeisRequestable.swift b/Sources/NeiSwift/Protocol/NeisRequestable.swift index bb5b8c9..1aa9d9e 100644 --- a/Sources/NeiSwift/Protocol/NeisRequestable.swift +++ b/Sources/NeiSwift/Protocol/NeisRequestable.swift @@ -30,7 +30,7 @@ public extension NeisRequestable where Self: HasURLSession, Self: HasNeisParser, if let data { do { - let json = try JSONSerialization.jsonObject(with: data) as? [String: Any] ?? [:] + let json = try JSONSerialization.jsonObject(with: data, options: .fragmentsAllowed) as? [String: Any] ?? [:] let response: T = try neisParser.parse(json: json, key: "\(key)") completion(.success(response)) } catch { diff --git a/Sources/NeiSwift/Public/NeisProtocol+Impl.swift b/Sources/NeiSwift/Public/NeisProtocol+Impl.swift index 772eb57..1ddbd9e 100644 --- a/Sources/NeiSwift/Public/NeisProtocol+Impl.swift +++ b/Sources/NeiSwift/Public/NeisProtocol+Impl.swift @@ -92,9 +92,13 @@ public extension NeisProtocol where Self: NeisRequestable { private extension Dictionary where Key == String, Value == Any { func buildParameters() -> [URLQueryItem] { - self.reduce(into: [URLQueryItem]()) { partialResult, dict in + var parameters = self.reduce(into: [URLQueryItem]()) { partialResult, dict in guard let value = dict.value as? String else { return } partialResult.append(URLQueryItem(name: dict.key, value: value)) } + parameters.append( + URLQueryItem(name: "Type", value: "json") + ) + return parameters } } diff --git a/Sources/NeiSwift/Public/Response/MealInfoResponse.swift b/Sources/NeiSwift/Public/Response/MealInfoResponse.swift index ccd1415..39400b4 100644 --- a/Sources/NeiSwift/Public/Response/MealInfoResponse.swift +++ b/Sources/NeiSwift/Public/Response/MealInfoResponse.swift @@ -16,7 +16,7 @@ public struct MealInfoResponse: Codable { /// 급식일자 public let MLSV_YMD: String /// 급식인원수 - public let MLSV_FGR: String + public let MLSV_FGR: Int /// 요리명 public let DDISH_NM: String /// 원산지정보