From 6ad687f4344fe919f525042f0ccff5a395715f5f Mon Sep 17 00:00:00 2001 From: Abdula Magomedov Date: Tue, 24 Aug 2021 15:28:16 +0300 Subject: [PATCH] fix bag in json printer. printed true and false when number equal 1 and 0 respectively --- Pulse/Sources/PulseUI/Services/JSONPrinter.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Pulse/Sources/PulseUI/Services/JSONPrinter.swift b/Pulse/Sources/PulseUI/Services/JSONPrinter.swift index f0d0e4d1d..799e5af49 100644 --- a/Pulse/Sources/PulseUI/Services/JSONPrinter.swift +++ b/Pulse/Sources/PulseUI/Services/JSONPrinter.swift @@ -112,8 +112,14 @@ final class JSONPrinter { } append("]", .punctuation) } - case let object as Bool: - append(object ? "true" : "false", .valueOther) + case let number as NSNumber: + if number === kCFBooleanTrue { + append("true", .valueOther) + } else if number === kCFBooleanFalse { + append("false", .valueOther) + } else { + append("\(number)", .valueOther) + } default: if json is NSNull { append("null", .null)