Custom the order of the keys in a JSON when encode
- Dominant language
- Swift
- Stars
- 4.3k
- Forks
- 677
- PR merge metrics
- No merged PRs in 30d
Description
struct RequestCommand: Codable {
var event: String
var uuid: String
var type: String
var data: [String]
}
{
"data": [
"A",
"B",
"C"
],
"event": "click",
"type": "Button",
"uuid": "123456"
}
After encoding the order of the keys in the JSON isn't the same as the fields in the RequestCommand.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how RequestCommand is encoded through Swift's Codable path and compare the produced JSON with the declared property order. Determine whether the library exposes a way to control key order; done means encoding preserves the requested event, uuid, type, data order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100