Skip to content

Instantly share code, notes, and snippets.

@hayajo
Created July 6, 2011 08:52
Show Gist options
  • Save hayajo/1066860 to your computer and use it in GitHub Desktop.
Save hayajo/1066860 to your computer and use it in GitHub Desktop.
test json.el
(require 'json)
(setq hash (make-hash-table :test 'equal))
(puthash "hoge" "HOGE" hash)
(puthash "fuga" "FUGA" hash)
(puthash "piyo" "PIYO" hash)
(json-encode "hoge") ;string
(json-encode ["hoge" "fuga" "piyo"]) ;array
(json-encode '("hoge" "fuga" "piyo")) ;list
(json-encode hash) ;hash-table
(json-encode '(("hoge" . "HOGE") ("fuga" . "FUGA") ("piyo" . "PIYO")))
(json-encode '(("hoge" . (("fuga" . "FUGA") ("piyo" . "PIYO"))) ("foo" . (("bar" . "BAR") ("buz" . "BUZ")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment