Closed SamuraiAku closed 7 months ago
When using JSON.jl, to get back the objects in order you can pass in a dicttype arg:
you can pass dicttype=DataStructures.OrderedDict to maintain the insertion order of the items in the object;
(As I understand it, the reason is that the JSON spec says that objects are un-ordered collections, even though various implementations do provide functionality to read/write in ordered ways)
I use the orderedDict in SPDX.jl and it works well. I think the bug is in how I'm creating the relationship vector in my own code. Need to review more and document a good example case.
I care about the order because it allows for a user to read in a file, make some small modifications such as update the version and checksum, and then write it all back to file and only those changed elements show up in a git diff. If I don't use OrderedDict there's no guarantee that would happen.
I tried recreating the issue and I can't do it. It doesn't matter anymore since I've updated the internal compare functions so they can handle out of order vectors. Close it for now, reopen if I find the bug again and I think it's important.
Read a JSON file, then write it back out to another JSON file, then read that second file. The order of entries the Relationships vector is different. It doesn't matter at all from a data model point of view, but why does it do that?