sops icon indicating copy to clipboard operation
sops copied to clipboard

Error unmarshalling file : Expected JSON object start, got delimiter [ instead

Open DennisGaida opened this issue 2 months ago • 2 comments

Using the following dummy data to create a dummy.json file: https://microsoftedge.github.io/Demos/json-dummy-data/64KB.json

Trying to encrypt the file using sops:

sops encrypt --age <age> dummy.json > dummy.json.enc

Receive the error: Error unmarshalling file: Could not unmarshal input data: Expected JSON object start, got delimiter [ instead.

The JSON file is perfectly valid and just starts with an array instead of on object.

DennisGaida avatar Oct 14 '25 07:10 DennisGaida

SOPS only supports JSON files with a global mapping, not other top-level JSON types. Your file is a top-level array.

felixfontein avatar Oct 14 '25 08:10 felixfontein

SOPS only supports JSON files with a global mapping, not other top-level JSON types. Your file is a top-level array.

Understood. Would be nice if this were documented somewhere and/or the error message would say so, since this is perfectly valid JSON. Checking https://github.com/getsops/sops?tab=readme-ov-file#json-and-json-binary-indentation doesn't say anything about global mapping. Also trying other samples (https://sample.json-format.com/) with the same result (obviously - also arrays).

DennisGaida avatar Oct 14 '25 08:10 DennisGaida