I work with ELisp hash-table and I would like to have a better printed representation of it. I'm on Emacs version 24.5.1. When I create a hash-table
(setq table (make-hash-table)) (puthash :name "john" table) (puthash :age 31 table)
I get something like:
#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8 data (:name "john" :age 31))
But I just want to have the content (i.e.
data) of my hash-table.
(:name "john" :age 31)
I know that you can have a specific printed representation in Common Lisp thanks to the
print-object method. Even the pretty printer
pp displays the hash-table metadata. Any idea?
(json-encode #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8 data (:name "john" :age 31))).
json-encodeis a pretty good idea. In order to get a more readable ELisp structure, I can do
(json-read-from-string (json-encode table)). It works well, even if this is not the most effective way. I also take a look to ht.el and I can have a nice list of pairs
(:name "john")thanks to a