jakartaee / jakartaee/jsonb-api
LEXICOGRAPHICAL property order is under-specified
- Dominant language
- Java
- Stars
- 95
- Forks
- 41
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 35
Description
Or to be more correct; if the lexicographical sorting order is going to be of any utility* it could benefit by a more detailed definition. Here is an attempt creating such:
https://cyberphone.github.io/doc/security/draft-rundgren-json-canonicalization-scheme.html#json.sorting.properties
In my Java-based JSON tools I use
```java
for (String property : canonicalized ? new TreeSet(object.properties.keySet()) : object.properties.keySet()) {
```
which complies with the specification above. Presumably your RI does that as well, right?
*) It is not very clear what the _purpose_ is with this mode. ECMAScript has an entirely different default property ordering mode which is based on the fairly simple idea that declaration/parsing order has a meaning which makes sense for objects like:
```json
{
"name": "John Doe",
"address": "2000 Sunset Boulevard",
"city": "Los Angeles",
"zip": "90001",
"state": "CA"
}
```
Using lexicographical ordering it would be serialized in the order "address", "city", "name", "state" and "zip", which adds fuzziness to the data from a human (developer or technical support), perspective.
Contributor guide
Research direction
Start with the issue body and the linked JSON Canonicalization Scheme property-sorting definition, then compare its proposed behavior with the Java TreeSet example and the JSON-B RI. Done means the project has a decided, detailed definition of lexicographical property ordering and clarifies the purpose of this mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100