Skip to content

Releases: postmates/PMJSON

PMJSON v4.0.0

15 Nov 04:46
Compare
Choose a tag to compare
  • Update to Swift 5.
  • When encoding/decoding URLs with JSON.Encoder and JSON.Decoder, encode and decode their absolute string instead of relying on the native implementation which encodes them as an object. This matches the behavior of JSONEncoder and JSONDecoder.
  • Fix availability attribute for JSON.Encoder.DateEncodingStrategy.iso8601WithFractionalSeconds.
  • Bump JSON.Encoder.DateEncodingStrategy.iso8601WithFractionalSeconds and JSON.Encoder.DateEncodingStrategy.iso8601WithFractionalSeconds to iOS 11.2+ and tvOS 11.2+ as, despite the constant being marked as available earlier, it's not supported at runtime. (#33)
  • Convert JSONObject.ns and JSONObject.nsNoNull to return a [String: Any] instead of an [AnyHashable: Any]. (#25)
  • Split JSON.Encoder.encodeAs* and JSON.Decoder.decode methods into overload pairs where one takes options: and the other doesn't. This makes it easier to replace function references to JSONEncoder/JSONDecoder methods with the equivalents from PMJSON.
  • Add conformance to Combine's TopLevelEncoder and TopLevelDecoder, using Data as the input/output type. This means that JSON.Encoder.encode(_:) is now marked as deprecated instead of unavailable.
  • Rename JSON.flatMap* and JSONObject.flatMap* methods to .compactMap* instead when the transformation returns an optional. (#28)
  • Mark a lot of methods as @inlinable.

PMJSON v3.1.2

07 Nov 08:05
Compare
Choose a tag to compare
  • Add method JSONError.withPrefix(_:) that returns a new error by prepending a prefix onto the path. This can be used in custom parsing code to produce good errors if the existing convenience functions don't do what you want. (#26)

PMJSON v3.1.1

18 May 02:19
Compare
Choose a tag to compare
  • Squelch Swift 4.1 warnings.

PMJSON v3.1.0

26 Feb 07:35
Compare
Choose a tag to compare
  • Improve .pretty output for empty arrays/dictionaries.
  • Speed up JSON.encodeAsData() pretty significantly. It's now very nearly as fast as JSON.encodeAsString().
  • Speed up JSON.Encoder.encodeAsString() and JSON.Encoder.encodeAsData().
  • Add a couple of convenience static methods to JSON that mimic the enum cases: JSON.int(_:) and JSON.cgFloat(_:). These can be used when JSON(_:) triggers too much type complexity. Also add a JSON(_:) override for CGFloat.
  • Add JSON.Encoder.keyEncodingStrategy. This is very similar to Swift 4.1's JSONEncoder.keyEncodingStrategy, although by default it won't apply to any nested values of type JSON or JSONObject (there's another option applyKeyEncodingStrategyToJSONObject that controls this).
  • Add JSON.Decoder.keyDecodingStrategy. This is very similar to Swift 4.1's JSONDecoder.keyDecodingStrategy, although by default it won't apply to decoding any values of type JSON or JSONObject (there's another option applyKeyDecodingStrategyToJSONObject that controls this).
  • Add JSON.Encoder.dateEncodingStrategy. This is very similar to JSONEncoder.dateEncodingStrategy except it includes another case for encoding ISO8601-formatted dates with fractional seconds (on Apple platforms).
  • Add JSON.Decoder.dateDecodingStrategy. This is very similar to JSONDecoder.dateDecodingStrategy except it includes another case for decoding ISO8601-formatted dates with fractional seconds (on Apple platforms).
  • Add JSON.Encoder.dataEncodingStrategy. This is identical to JSONEncoder.dataEncodingStrategy.
  • Add JSON.Decoder.dataDecodingStrategy. This is identical to JSONDecoder.dataDecodingStrategy.

PMJSON v3.0.2

22 Feb 04:57
Compare
Choose a tag to compare
  • Add convenience property JSONError.path.
  • Add method JSONError.withPrefixedCodingPath(_:) to make it easier to use JSONError-throwing methods in a Decodable implementation.

PMJSON v3.0.1

19 Feb 05:37
Compare
Choose a tag to compare
  • Fix Swift Package Manager support.

PMJSON v3.0.0

19 Feb 05:11
577b7e2
Compare
Choose a tag to compare
  • Convert to Swift 4.
  • Implement Codable on JSON.
  • Add a Swift.Decoder implementation called JSON.Decoder.
  • Add a Swift.Encoder implementation called JSON.Encoder.

PMJSON v2.0.3

12 Sep 20:27
Compare
Choose a tag to compare
  • Add Linux support for Decimal (on Swift 3.1 and later). NOTE: Decimal support is still buggy in Swift 3.1, and the workarounds we employ to get the correct values on Apple platforms don't work on Linux. You probably shouldn't rely on this working correctly on Linux until Swift fixes its Decimal implementation.
  • Add Linux support for decoding from/encoding to Data.
  • Add Linux support for LocalizedError on the Error types (only really applies to Swift 3.1 and later).
  • Fix compilation on Linux using the release configuration.
  • Support running the test suite with swift test.

PMJSON v2.0.2

06 Mar 23:45
Compare
Choose a tag to compare
  • Fixes Linux compatibility

PMJSON v2.0.1

26 Feb 23:02
Compare
Choose a tag to compare
  • Add method JSON.parser(for:options:) that returns a JSONParser<AnySequence<UnicodeScalar>> from a Data. Like JSON.decode(_:options:), this method automatically detects UTF-8, UTF-16, or UTF-32 input.
  • Fix compatibility with Swift Package Manager.