Skip to content

[CLI][JSON] Make JSON structure uniform for 1 and 2+ input files #1103

Description

@alex3kov

Currently --Output=JSON outputs a json object if passed a single file and an array of json objects if passed 2+ files:

$ mediainfo --Output=JSON 1.mkv
{ ... }
$ mediainfo --Output=JSON 1.mkv 2.mkv
[ { ... }, { ... } ] 

This creates a problem in scripts that deal with arbitrary number of files (sometimes 1, sometimes 2+) as an object and an array of objects need to be handled differently.

Suggestion: always output an array of objects (in case of 1 file - an array with a single object).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions