I’m working on an application where the order of related resources in a JSON array has semantic importance. It doesn’t look like there’s any word on this within the spec so I want to ask here. I’m wondering about the default sort order that the API should return objects in. I would like and kind of expect them to be returned in the same order that the client created them in. Specifically, I want to ensure that clients retrieve related resources in the exact order they created, updated or added them. Before finalizing this approach, I’d like to gather insights and feedback from the community.
- Consistency: Is it common practice in the JSON:API community to preserve the order of related resources? Are there any challenges or pitfalls I should be aware of?
- Storage and Retrieval: For those who have implemented such an order-preserving system, how did you handle it at the database level? Especially in contexts where the storage mechanism might not natively support order preservation.
Any advice, experiences, or insights would be greatly appreciated!
Thank you in advance.