Skip to content

Empty JSON output is 'null' instead of '[]' — breaks jq pipelines #16

Description

@DTTerastar

Severity

major

Summary

Every export subcommand emits the literal string null (plus newline) on stdout when there is no data in the window. The contract (and the CLI's own prime text) say empty results must be [] so callers can pipe to jq without special-casing.

Reproduce

$ withings-export activity --since 2030-01-01 --json
null
$ withings-export sleep --since 2030-01-01 --json
null
$ withings-export workouts --since 2030-01-01 --json
null
$ withings-export measurements --since 2030-01-01 --json
null
$ withings-export measurements --types 999 --since 30d --json
null

jq 'length' <<< null errors: jq: error: null (null) has no length.

Expected

Empty results print []\n, exit 0. Already fixed on main in commit b580683 (printJSON reflects on nil slices), but missing from the v0.2.1 release. See #14.

Metadata

Metadata

Assignees

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