Skip to content

adapter.json: Non-deterministic array order in serialized JSON #573

Closed

Description

@thammel

JSON arrays that originate from unordered Python sets are serialized in non-deterministic order. Affected are the top-level object lists and set-valued attributes such as submodel and isCaseOf.

Expected behavior:
Serializing the same AAS twice produces byte-identical JSON, so output is reproducible across runs.

Actual behavior:
Array element order varies between runs. Set iteration order depends on hash randomization (PYTHONHASHSEED), so each serialization can emit a different ordering. This makes output non-reproducible — complicates diffing, caching, and snapshot testing.

Activity

  1. s-heppner commented on Jun 19, 2026

    @s-heppner
    Member

    What's your use-case?

    Personally, I think it'd be a good feature to have consistent outputs.
    However, the specification of the AAS defines the output as unordered (we have discussed this several times already), so you cannot guarantuee order when getting AAS files elsewhere. Semantic comparision of AAS data is a complex question.

    I will mark this as a discussion for the future, since I can't currently see how complex this would be to implement (nor if it would produce backward incompatible changes).

    Edit: Just saw that you already provided a fix. I'll review it and let's see if there's any complicating issues.

  2. added
    enhancement
    discussion
    on Jun 19, 2026
  3. added a commit that references this issue on Aug 31, 2026
    507444a
  4. added a commit that references this issue on Oct 29, 2026
    2ea9b55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionenhancementhigh priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions