I need to read an arbitrary JSON file – structure is not known up-front. I am trying to use JSONSerialization from Foundation (system details at the end).
The following code causes an error:
let ser = JSONSerialization()
The error:
Thread 1: "*** +[NSJSONSerialization allocWithZone:]: Do not create instances of NSJSONSerialization in this release"
I tried to have a look at the new Swift FoundationPreview package, however it does not seem to have JSONSerialization (as of today). It just has JSONCoder/JSONDecoder which require the values to be typed (Any
can not be decodable).
I would prefer to stay within official set of packages/libraries/frameworks.
What is the (official) alternative to read an arbitrary JSON file?
System details:
- OS: macOS Ventura – 13.4.1 (22F82)
- XCode Version 15.0 beta 2 (15A5161b)