Commit b93bde18 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Fix pretty-printing of {}

* lisp/json.el (json-pretty-print): Fix reading {}, which returns nil.
parent c198ecda
Pipeline #2357 passed with stage
in 58 minutes and 12 seconds
......@@ -764,13 +764,15 @@ With prefix argument MINIMIZE, minimize it instead."
(json-null :json-null)
;; Ensure that ordering is maintained
(json-object-type 'alist)
(err (gensym))
json)
(save-restriction
(narrow-to-region begin end)
(goto-char begin)
(while (setq json (condition-case _
(json-read)
(json-error nil)))
(while (not (eq (setq json (condition-case _
(json-read)
(json-error err)))
err))
(delete-region begin (point))
(insert (json-encode json))
(setq begin (point))))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment