api,cmd,io: change run command and api handler to wrap messages in json