Skip to content

winml sys --list-device --list-ep --format json outputs two separate JSON arrays (invalid JSON) #229

@DingmaomaoBJTU

Description

@DingmaomaoBJTU

Summary

When combining --list-device and --list-ep with --format json, winml sys prints two separate JSON arrays back-to-back instead of a single valid JSON document. Any downstream consumer calling json.loads() or json.load() fails with JSONDecodeError: Extra data.

Steps to Reproduce

winml sys --list-device --list-ep --format json

Actual Output

[
  {
    "priority": 1,
    "type": "CPU",
    "name": "AMD EPYC 7763 64-Core Processor",
    ...
  }
]
[
  {
    "name": "DmlExecutionProvider",
    "device": "GPU",
    "path": null
  },
  ...
]

Expected Output

A single valid JSON object, e.g.:

{
  "devices": [...],
  "executionProviders": [...]
}

Root Cause

src/winml/modelkit/commands/sys.py lines 617–639: the --list-device and --list-ep branches each independently call their own JSON output function, emitting two separate arrays with no wrapping structure.

Impact

Breaks scripting use cases. winml sys --list-device --list-ep --format json | python -c "import sys,json; json.load(sys.stdin)" raises JSONDecodeError.

Severity

P2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions