       (semantic_triggers . ())
       (auto_trigger . 1))))
 
+(defun ycmd-running? ()
+  (interactive)
+  (if (get-process ycmd-server-process) 't nil))
+
 (defun ycmd-create-options-file (hmac-secret)
   (let ((options-file (make-temp-file "ycmd-options"))
         (options (ycmd-options-contents hmac-secret)))
     (with-temp-file options-file
-      ; TODO: Need to encode the semantic-triggers (and all empty lists) as "{}" rather than "null".
-      (insert (json-encode options)))
+      (insert (ycmd-json-encode options)))
     options-file))
 
 (defun ycmd-open ()

                             (list ycmd-server-command)))
           (args (list (concat "--options_file=" options-file)))
           (server-program+args (append server-command args))
           (proc (apply #'start-process "ycmd-server" proc-buff server-program+args))
           (cont 1))
      (while cont
        (set-process-query-on-exit-flag proc nil)

(require 'hmac-def)
(require 'hmac-md5) ; provides encode-hex-string
(require 'json)
(require 'request)

