Also convert json-fix.el to use cl-lib

This commit is contained in:
Steve Purcell 2013-04-10 11:05:41 +01:00
parent 376be7f890
commit 3b9792f778

View file

@ -1,6 +1,7 @@
;;; Fixes for json.el such that integer plist / alist keys are rendered as strings, in order to comply with the json spec
(require 'json)
(require 'cl-lib)
(defun json-encode-key-value-pair (pair)
"Encode a (key . value) PAIR as JSON, ensuring that key is encoded into a string."
@ -26,9 +27,9 @@
(defun json-encode-plist (plist)
"Return a JSON representation of PLIST."
(json-encode-alist
(loop while plist
collect (cons (car plist) (cadr plist))
do (setf plist (cddr plist)))))
(cl-loop while plist
collect (cons (car plist) (cadr plist))
do (setf plist (cddr plist)))))
(provide 'json-fix)