github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/docs/user-guide/formatted-output.md (about) 1 # Formatted output (json/yaml) 2 3 `vcn` can output results in `json` or `yaml` formats by using the [--output global flag](../cmd/vcn.md#options). 4 > Although all commands support `--output`, some could return an empty results (ie. `vcn login`, `vcn logout`, and `vcn dashboard`). 5 6 ## Examples 7 8 ``` 9 vcn authenticate docker://nginx --output yaml 10 ``` 11 12 ``` 13 vcn list --output json 14 ``` 15 16 ``` 17 vcn notarize file.txt 18 ``` 19 > You need to set `VCN_NOTARIZATION_PASSWORD` [environment variable](environments.md#other-environment-variables) to make `vcn` work in non-interactive mode 20 21 ## Dealing with errors 22 23 When an error is encountered, `vcn` will print the usual error message to the *Standard error* but also will return an error object (formatted accordingly to `--output`) to the *Standard output*. 24 25 ### Example of mixed *Standard error* and *Standard output* 26 ``` 27 $ vcn authenticate non-existing.txt --output json 28 Error: open non-existing.txt: no such file or directory 29 { 30 "error": "open non-existing.txt: no such file or directory" 31 } 32 ``` 33 34 ### Example of redirecting the *Standard output* to get the formatted result 35 ``` 36 $ vcn authenticate non-existing.txt --output json > output.json 37 Error: open non-existing.txt: no such file or directory 38 39 $ cat output.json 40 { 41 "error": "open non-existing.txt: no such file or directory" 42 } 43 ```