Properly serialise output of endpoint command