From 59ad97f508e546b2df66f60e1cf70605f7e4960e Mon Sep 17 00:00:00 2001
From: Kenta Kubo <601636+kkk669@users.noreply.github.com>
Date: Wed, 25 Oct 2023 00:55:20 +0900
Subject: [PATCH] fix: fix build for iOS, tvOS, and watchOS

---
 Sources/SwiftJSONFormatter/SwiftJSONFormatter.swift | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Sources/SwiftJSONFormatter/SwiftJSONFormatter.swift b/Sources/SwiftJSONFormatter/SwiftJSONFormatter.swift
index ce12846..7dd0e60 100644
--- a/Sources/SwiftJSONFormatter/SwiftJSONFormatter.swift
+++ b/Sources/SwiftJSONFormatter/SwiftJSONFormatter.swift
@@ -75,7 +75,9 @@ public struct SwiftJSONFormatter {
       let decoder = JSONDecoder()
       if let data = jsonString.data(using: .utf8), let result = try? decoder.decode(String.self, from: data) {
         let encoder = JSONEncoder()
-        encoder.outputFormatting = .withoutEscapingSlashes
+        if #available(iOS 13, tvOS 13, watchOS 6, *) {
+          encoder.outputFormatting = .withoutEscapingSlashes
+        }
         if let encoded = try? encoder.encode(result), let encodedString = String(data: encoded, encoding: .utf8) {
           return encodedString
         }