Skip to content

Commit e4329b4

Browse files
authored
Merge pull request PerfectlySoft#214 from rymcol/JSON-Int32-Int64
Added Int32 & Int64 Extensions (Plus Unsigned)
2 parents 914beed + 9a46b92 commit e4329b4

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Sources/PerfectLib/JSONConvertible.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,34 @@ extension UInt: JSONConvertible {
180180
}
181181
}
182182

183+
extension Int32: JSONConvertible {
184+
/// Convert an Int into JSON text.
185+
public func jsonEncodedString() throws -> String {
186+
return String(self)
187+
}
188+
}
189+
190+
extension Int64: JSONConvertible {
191+
/// Convert an Int into JSON text.
192+
public func jsonEncodedString() throws -> String {
193+
return String(self)
194+
}
195+
}
196+
197+
extension UInt32: JSONConvertible {
198+
/// Convert an Int into JSON text.
199+
public func jsonEncodedString() throws -> String {
200+
return String(self)
201+
}
202+
}
203+
204+
extension UInt64: JSONConvertible {
205+
/// Convert an Int into JSON text.
206+
public func jsonEncodedString() throws -> String {
207+
return String(self)
208+
}
209+
}
210+
183211
extension Double: JSONConvertible {
184212
/// Convert a Double into JSON text.
185213
public func jsonEncodedString() throws -> String {

0 commit comments

Comments
 (0)