Skip to content

Commit

Permalink
Fix JSON output
Browse files Browse the repository at this point in the history
Fixes #43
  • Loading branch information
elyscape committed Aug 5, 2022
1 parent f380a7b commit f816622
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/CoreLocationCLI/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class Delegate: NSObject, CLLocationManagerDelegate {

switch format {
case .json:
print(try! JSONEncoder().encode(formattedParts))
let output = try! JSONEncoder().encode(formattedParts)
print(String(data: output, encoding: .utf8)!)
case .string(let output):
print(formattedParts.reduce(output, { partialResult, keyValuePair in
partialResult.replacingOccurrences(of: "%\(keyValuePair.key)", with: keyValuePair.value ?? "")
Expand Down

0 comments on commit f816622

Please sign in to comment.