How to change audio output from ssh?

How can I change the audio output (HDMI, analog, etc) from SSH, please? I guess this must be specified in a config file somewhere?

I am running a headless Pi and would like to avoid the hassle of disconnecting it to attach it to a monitor.

Nevermind. From How can I chage the audio output device from the command line., it looks like the audio output device is specified in: ~/.kodi/userdata/guisettings.xml

<audiooutput>
     <ac3passthrough default="true">true</ac3passthrough>
     <ac3transcode default="true">false</ac3transcode>
     <audiodevice>PI:Both</audiodevice>
     ...
</audiooutput>

You also could do it via json

curl -H “Content-type: application/json” -X POST -d ‘{“jsonrpc”:“2.0”,“method”:“Settings.SetSettingValue”, “params”:{“setting”:“audiooutput.audiodevice”,“value”:“PI:HDMI”},“id”:1}’ http://xbmc:xbmc@osmc:8080/jsonrpc

Interesting. But I am not too sure what it means? Can you elaborate, please?

I searched for documentation, and found this: http://kodi.wiki/view/JSON-RPC_API

I gather this is a different protocol, but I am not too clear how it is used in this context. Does this mean I could have used a browser somehow, or would I have had to enable JSON and script something (Python, etc)?

Not directly a simply browser. My example is a script which uses curl so if you have a linux system you just can use the example as it is. If you want to use webbrowser check the kodi wiki you shared and check “5.2.2 HTTP”