Skip to content

Release 2.0

Latest

Choose a tag to compare

@objecthub objecthub released this 06 Oct 16:45
· 4 commits to main since this release
  • Migration to Swift 6 language mode: public value types (JSONLocation, JSONPointer, JSONPath, JSONSchema, ...) and protocol JSONReference are now Sendable; the userInfo parameters of the encoding/decoding methods have type [CodingUserInfoKey : any Sendable]; format validators are @Sendable functions; JSONSchemaRegistry.default is declared nonisolated(unsafe)
  • Support for reading streams of JSON values via JSON.values(from:format:options:) and JSON.results(from:format:options:): NDJSON/JSON Lines, JSON text sequences (RFC 7464, RFC 8142), concatenated JSON, and elements of top-level arrays
  • Support for server-sent events (JSON.StreamFormat.serverSentEvents, JSON.events(from:)) and for reading JSON values that arrive in fragments (JSONPartialParser, JSON.partialValues(from:), JSON.fragments(from:at:)), e.g. for streaming APIs of large language models
  • Lenient parsing and extraction of JSON from the output of large language models: JSON.extract(from:options:), JSON.extractFirst(from:options:), and JSON(lenient:) find values in prose and Markdown code blocks, and accept comments, trailing commas, single quotes, unquoted keys, Python literals, and truncated values
  • Support for writing streams of JSON values: JSONStreamWriter, JSON.stream(_:format:options:), JSON.write(_:to:format:options:), and JSONByteStream create NDJSON, JSON text sequences, concatenated JSON, JSON arrays, and server-sent events (ServerSentEvent.encoded)
  • Tests for streaming with larger real-world data files
  • New demo tool WikiWatch that processes Wikimedia's recent changes event stream