I'm working on parsing a JSON file into a dictionary: // JSON Payload File
{
"orderPlaced": "done",
"prep": "pending",
"shipped" : "pending"
}Here is my code to make a dictionary from that file:
if let path = Bundle.main.path(forResource: "JSONPayload", ofType: "json") {
do {
// Data from JSON file path
let data = try Data(contentsOf: URL(fileURLWithPath: path), options: [])
// JSON dicrtionary being made
let json = try JSONSerialization.jsonObject(with: data) as! [String: Any]
print(json)
} catch let jsonErr {
print("err", jsonErr)
}Expected output: ["orderPlaced": done, "prep": pending, "shipped": pending]The actual output is: ["shipped": pending, "orderPlaced": done, "prep": pending]Is there a way I can re-order my dictionary or have it ordered from the start. I'm assuming the latter request might not be doable since dictionaires from my understanding are un-ordered. Maybe the only thing I can do is re-order after the dictionary is made, but how would i do that? Do I have to modify my JSON file and the Swift code or just one or ther other?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi, So I have been recently work on some research for a Health Care application where HIPPA compliance is a requirement. I had done research into FireBase and that seemed good, but as of May 2018 it is not HIPPA compliant. I was looking around and Apple CloudKit seems like a good option, however I could not find any information from Apple's developer pages about CloudKit on whether it was HIPPA compliant or not?
Hi,Does anyone know how to add images inline in a post. Sometimes I have a question and it is best explained with accompanying text and an image or screenshot. Do Apple Developer Forums even support images... if so, @AppleDeveloperForums... please add this feature.. Thanks!