Comments (6)
Some context from HN : https://news.ycombinator.com/item?id=5654116
from json-api.
I understand the momentum of the existing tools for keeping it array based, so I don't expect it to change. That said, I think alexkcd made some good points in the HN thread that could also provide some assistance around the "primary document among others of the same type" problem being discussed in issue #8. So there may be more motivation for reconsidering...
from json-api.
@lukfugl - One of the main reasons that a list is used is because of order. Using a hash indicates that the response is not necessarily ordered. This is subtle, but very important.
from json-api.
Beyond order, I'd argue for performance. Array operations and hash operations have wildly differing performance characteristics. If people are interested (or think I'm wrong--I may be) I'll write and run some quick benchmarks to illustrate my point.
from json-api.
Ultimately, there are pros and cons to each side, and we made a choice towards arrays. There's nothing super bad about hashes, but this really boils down to a bikeshed.
from json-api.
In particular, looping over an Array is much faster than looping over an Object in JavaScript. Since a main use-case we have in mind is for a smart client to load the objects into a local store, it's easy for the loading code to index by ID, which will then produce fast lookup by ID later, but fast load initially.
from json-api.
Related Issues (20)
- Is there any way to include not related models into a model for JsonApiFramework 2.8.0? HOT 2
- Provide JSON Schema for JSON:API 1.1 HOT 2
- Provide an updates list/blog HOT 9
- 1.1 seems to contain a breaking change - 'lid' now required for resource creation? HOT 2
- How is 'lid' actually used? The 1.1 spec says nothing about this HOT 13
- Allow custom resource links HOT 13
- Why the square bracket syntax for query params? HOT 7
- consider support for implementation-specific members HOT 2
- JSON-LD integration example HOT 1
- Clarify intent of links member HOT 1
- How does one document a JSON:API HOT 4
- 1.1 spec disallows e.g. filter[author.name] HOT 4
- Inclusion of related resources for heterogeneous collections
- PrimaryResourceType not to be null at this point HOT 1
- Create/update relationships having attributes? HOT 3
- ember-data link on implementations page is broken HOT 2
- Bulk delete as either extention or implementation HOT 4
- Extend Spec To Allow Creation of Multiple Resources in One API Call HOT 1
- Profiles should be allowed to define query parameters HOT 5
- JSONRenderer does not extract includes from PolymorphicModelSerializer properly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-api.