GNU bug report logs - #42733
27.1; json-serialize doesn't not encode list like json-encode

Previous Next

Package: emacs;

Reported by: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>

Date: Thu, 6 Aug 2020 22:18:02 UTC

Severity: normal

Tags: moreinfo, notabug

Found in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42733 in the body.
You can then email your comments to 42733 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#42733; Package emacs. (Thu, 06 Aug 2020 22:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 06 Aug 2020 22:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; json-serialize doesn't not encode list like json-encode
Date: Thu, 06 Aug 2020 23:17:47 +0100
Reproduction:

(json-encode '("foo" "bar"))
=> "[\"foo\",\"bar\"]"

(json-serialize '("foo" "bar"))

Debugger entered--Lisp error: (wrong-type-argument symbolp "foo")
  json-serialize(("foo" "bar"))

The potential for people to naively substitute json-encode with
json-serialize and breaking their code is enormous. This is already
happening in lsp-mode. Please make json-serialize behave like
json-encode.

Jimmy Yuen Ho Wong


In GNU Emacs 27.1 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.6 (Build 19G73))
 of 2020-07-30 built on MobileCat.local
Repository revision: d024fc141bab0b8d3400dc6b53eac1ed199ddb1f
Repository branch: HEAD
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.6

Recent messages:
Back to top level
Entering debugger...
"[1,2,3]"
[1 2 3]
"[1,2,3]"
"[\"foo\",\"bar\"]"
Back to top level
Send this bug report to the Emacs maintainers? (y or n) n
report-emacs-bug-hook: M-x report-emacs-bug was canceled, please read *Bug Help* buffer
line-move-visual: Beginning of buffer
user-error: No window right from selected window
Configured using:
 'configure --prefix=/opt/local --without-dbus --without-gconf
 --without-libotf --without-m17n-flt --without-gpm --with-gnutls
 --with-xml2 --with-modules --infodir /opt/local/share/info/emacs
 --with-json --without-harfbuzz --with-ns --with-lcms2
 --with-imagemagick --with-rsvg 'CFLAGS=-pipe -Os
 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
 -arch x86_64' 'CPPFLAGS=-I/opt/local/include
 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk'
 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie
 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
 -arch x86_64''

Configured features:
RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS XIM NS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
  flycheck-pos-tip-mode: t
  projectile-rails-global-mode: t
  projectile-mode: t
  company-quickhelp-mode: t
  company-quickhelp-local-mode: t
  purpose-mode: t
  imenu-list-minor-mode: t
  diff-hl-flydiff-mode: t
  company-flx-mode: t
  dap-tooltip-mode: t
  dap-ui-many-windows-mode: t
  dap-ui-controls-mode: t
  dap-ui-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: deferred
  treemacs-fringe-indicator-mode: t
  dap-auto-configure-mode: t
  dap-mode: t
  crm-custom-mode: t
  override-global-mode: t
  winner-mode: t
  which-key-mode: t
  smooth-scrolling-mode: t
  show-smartparens-global-mode: t
  smartparens-global-mode: t
  show-paren-mode: t
  savehist-mode: t
  save-place-mode: t
  rxt-global-mode: t
  rxt-mode: t
  recentf-mode: t
  minibuffer-depth-indicate-mode: t
  ido-vertical-mode: t
  ido-ubiquitous-mode: t
  icomplete-vertical-mode: t
  global-whitespace-cleanup-mode: t
  global-tree-sitter-mode: t
  global-origami-mode: t
  origami-mode: t
  global-move-dup-mode: t
  move-dup-mode: t
  global-magit-file-mode: t
  which-function-mode: t
  magit-auto-revert-mode: t
  global-auto-revert-mode: t
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  global-hl-line-mode: t
  global-flycheck-mode: t
  global-diff-hl-mode: t
  flx-ido-mode: t
  ido-everywhere: t
  icomplete-mode: t
  fido-mode: t
  editorconfig-mode: t
  desktop-save-mode: t
  delete-selection-mode: t
  company-statistics-mode: t
  global-company-mode: t
  auto-compile-on-save-mode: t
  async-bytecomp-package-mode: t
  amx-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  buffer-read-only: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/opt/local/share/emacs/site-lisp/cmake-mode hides /Users/wyuenho/.emacs.d/elpa/cmake-mode-20190710.1319/cmake-mode
/Users/wyuenho/.emacs.d/elpa/xref-1.0.1/xref hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/progmodes/xref
/Users/wyuenho/.emacs.d/elpa/project-0.5.0/project hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/progmodes/project
/Users/wyuenho/.emacs.d/elpa/flymake-1.0.9/flymake hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/progmodes/flymake
/Users/wyuenho/.emacs.d/elpa/eldoc-1.8.0/eldoc hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/emacs-lisp/eldoc

Features:
(undo-fu shadow sort mail-extr emacsbug sendmail tabify cl-print
misearch multi-isearch visual-regexp-steroids visual-regexp autoload
jka-compr helpful trace edebug info-look elisp-refs loop two-column
all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons lsp-origami
lsp-completion lsp-diagnostics lsp-modeline view lsp-sqls lsp-yaml
lsp-xml lsp-vhdl lsp-vetur lsp-html lsp-verilog lsp-terraform
lsp-solargraph lsp-serenata lsp-rust lsp-python-ms lsp-pyls lsp-pwsh
lsp-perl lsp-json lsp-intelephense lsp-haxe lsp-go lsp-gdscript
lsp-fsharp lsp-eslint lsp-erlang lsp-elm lsp-css lsp-csharp lsp-clojure
lsp-clients dired-hide-dotfiles vc-mtn vc-hg vc-bzr vc-src vc-sccs
vc-svn vc-cvs vc-rcs diff-hl-dired dired-collapse dired-hacks-utils
company-web-html company-web company-css web-completion-data emmet-mode
web-mode smart-semicolon add-node-modules-path css-mode smartparens-html
sgml-mode eww mm-url gnus nnheader url-queue shr svg xml dom vc-git
flycheck-pos-tip flycheck-pyre python-black py-isort python-docstring
smartparens-python python tramp-sh docker-tramp tramp-cache tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat ls-lisp
projectile-rails rake inflections inf-ruby smartparens-ruby ruby-mode
smie autoinsert projectile company-quickhelp pos-tip company-keywords
company-etags etags fileloop generator company-gtags
company-dabbrev-code company-dabbrev company-yasnippet company-capf
company-emoji company-emoji-list company-files company-cmake
company-xcode company-clang company-semantic company-eclim
company-template rainbow-mode elisp-def ert debug backtrace
display-line-numbers cap-words superword subword smartparens-config
smartparens-javascript smartparens-org smartparens-markdown
smartparens-text smartparens-c form-feed editorconfig-core
editorconfig-core-handle editorconfig-fnmatch solarized-dark-theme
solarized-theme solarized solarized-faces spaceline-config
spaceline-segments spaceline powerline powerline-separators
powerline-themes hideshow beginend window-purpose-x shut-up
window-purpose window-purpose-fixes window-purpose-prefix-overload
window-purpose-switch window-purpose-layout window-purpose-core
window-purpose-configuration eieio-compat window-purpose-utils
imenu-list windmove magit-lfs magit-todos hl-todo org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp
ob-core ob-eval org-table ol org-keys org-compat org-macs org-loaddefs
cal-menu calendar cal-loaddefs forge-list forge-commands forge-semi
forge-bitbucket buck forge-gogs gogs forge-gitea gtea forge-gitlab glab
forge-github ghub-graphql treepy gsexp ghub let-alist forge-notify
forge-revnote forge-pullreq forge-issue forge-topic bug-reference
forge-post forge-repo forge forge-core forge-db closql emacsql-sqlite
emacsql emacsql-compiler diff-hl-flydiff ediff-merg ediff-mult
ediff-wind ediff-diff ediff-help ediff-init ediff-util dumb-jump popup
rg rg-info-hack rg-menu rg-ibuffer rg-result wgrep-rg wgrep rg-history
rg-header ibuf-ext ibuffer ibuffer-loaddefs grep swift-mode
swift-mode-imenu swift-mode-repl swift-mode-beginning-of-defun
swift-mode-font-lock swift-mode-standard-types swift-mode-indent
swift-mode-lexer yard-mode poly-markdown polymode poly-lock
polymode-base polymode-weave polymode-export polymode-compat
polymode-methods polymode-core polymode-classes eieio-custom eieio-base
json-mode json-reformat json-snatcher js cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
reformatter parse-time iso8601 flycheck-objc-clang cl-lib-highlight
eterm-256color term disp-table ehelp xterm-color native-complete
company-lsp company-flx dap-lldb dap-mouse dap-ui dap-ui-repl
lsp-treemacs lsp-treemacs-themes treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-interface
treemacs-extensions treemacs-persistence treemacs-mouse-interface
treemacs-tag-follow-mode treemacs-filewatch-mode treemacs-tags
treemacs-follow-mode treemacs-rendering treemacs-async
treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-scope pulse treemacs-faces
treemacs-icons treemacs-themes treemacs-core-utils pfuture ace-window
avy treemacs-logging treemacs-customization treemacs-macros gdb-mi gud
bui bui-list bui-info bui-entry bui-core bui-history bui-button
bui-utils lsp-lens dap-python dap-mode posframe dap-overlays
lsp-sourcekit lsp-jedi lsp lsp-mode lsp-protocol xref project spinner
markdown-mode color noutline outline lv inline ht f em-glob esh-util
dash-functional compile bindat tree-sitter-langs tree-sitter-langs-build
tar-mode arc-mode archive-mode pp tree-sitter-hl yasnippet-snippets
yasnippet crm-custom pager-default-keybindings pager browse-kill-ring
delight use-package-bind-key use-package-delight osx-trash bind-key
exec-path-from-shell quelpa-use-package use-package-core quelpa lisp-mnt
help-fns radix-tree mm-archive gnutls network-stream url-http url-gw nsm
url-cache url-auth url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap winner which-key
smooth-scrolling smartparens thingatpt paren savehist saveplace pcre2el
rxt re-builder recentf tree-widget mb-depth ido-vertical-mode
ido-completing-read+ memoize cus-edit wid-edit minibuf-eldef
icomplete-vertical help-at-pt whitespace-cleanup-mode whitespace
tree-sitter tree-sitter-load tree-sitter-cli tree-sitter-core
tree-sitter-dyn tree-sitter-dyn-get dired-aux origami origami-parsers
move-dup magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
magit-mode git-commit transient magit-git magit-section magit-utils crm
log-edit message rmc puny dired dired-loaddefs format-spec rfc822 mml
mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
mail-utils gmm-utils mailheader pcvs-util add-log with-editor cl-extra
shell pcomplete comint ring server hl-line flycheck ansi-color find-func
help-mode dash diff-hl vc-dir ewoc vc vc-dispatcher diff-mode easy-mmode
flx-ido flx ido icomplete editorconfig desktop frameset delsel
company-statistics company pcase auto-compile packed async-bytecomp
advice async amx s cus-start cus-load finder-inf edmacro kmacro rx cl
info package easymenu browse-url url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json
subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 1421509 540949)
 (symbols 48 65724 54)
 (strings 32 321417 88062)
 (string-bytes 1 8900750)
 (vectors 16 226691)
 (vector-slots 8 5366473 762388)
 (floats 8 1135 2969)
 (intervals 56 11183 4313)
 (buffers 1000 64))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42733; Package emacs. (Thu, 06 Aug 2020 22:30:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 27.1; json-serialize does not encode list like json-encode
Date: Thu, 6 Aug 2020 23:29:31 +0100
Note to self, always check the email subject before sending ....

On 06/08/2020 11:17 PM, Jimmy Yuen Ho Wong wrote:
> Reproduction:
>
> (json-encode '("foo" "bar"))
> => "[\"foo\",\"bar\"]"
>
> (json-serialize '("foo" "bar"))
>
> Debugger entered--Lisp error: (wrong-type-argument symbolp "foo")
>    json-serialize(("foo" "bar"))
>
> The potential for people to naively substitute json-encode with
> json-serialize and breaking their code is enormous. This is already
> happening in lsp-mode. Please make json-serialize behave like
> json-encode.
>
> Jimmy Yuen Ho Wong
>
>
> In GNU Emacs 27.1 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.6 (Build 19G73))
>   of 2020-07-30 built on MobileCat.local
> Repository revision: d024fc141bab0b8d3400dc6b53eac1ed199ddb1f
> Repository branch: HEAD
> Windowing system distributor 'Apple', version 10.3.1894
> System Description:  Mac OS X 10.15.6
>
> Recent messages:
> Back to top level
> Entering debugger...
> "[1,2,3]"
> [1 2 3]
> "[1,2,3]"
> "[\"foo\",\"bar\"]"
> Back to top level
> Send this bug report to the Emacs maintainers? (y or n) n
> report-emacs-bug-hook: M-x report-emacs-bug was canceled, please read *Bug Help* buffer
> line-move-visual: Beginning of buffer
> user-error: No window right from selected window
> Configured using:
>   'configure --prefix=/opt/local --without-dbus --without-gconf
>   --without-libotf --without-m17n-flt --without-gpm --with-gnutls
>   --with-xml2 --with-modules --infodir /opt/local/share/info/emacs
>   --with-json --without-harfbuzz --with-ns --with-lcms2
>   --with-imagemagick --with-rsvg 'CFLAGS=-pipe -Os
>   -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
>   -arch x86_64' 'CPPFLAGS=-I/opt/local/include
>   -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk'
>   'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie
>   -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
>   -arch x86_64''
>
> Configured features:
> RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB
> TOOLKIT_SCROLL_BARS XIM NS MODULES THREADS JSON PDUMPER LCMS2 GMP
>
> Important settings:
>    value of $LANG: en_GB.UTF-8
>    locale-coding-system: utf-8-unix
>
> Major mode: Help
>
> Minor modes in effect:
>    flycheck-pos-tip-mode: t
>    projectile-rails-global-mode: t
>    projectile-mode: t
>    company-quickhelp-mode: t
>    company-quickhelp-local-mode: t
>    purpose-mode: t
>    imenu-list-minor-mode: t
>    diff-hl-flydiff-mode: t
>    company-flx-mode: t
>    dap-tooltip-mode: t
>    dap-ui-many-windows-mode: t
>    dap-ui-controls-mode: t
>    dap-ui-mode: t
>    treemacs-filewatch-mode: t
>    treemacs-follow-mode: t
>    treemacs-git-mode: deferred
>    treemacs-fringe-indicator-mode: t
>    dap-auto-configure-mode: t
>    dap-mode: t
>    crm-custom-mode: t
>    override-global-mode: t
>    winner-mode: t
>    which-key-mode: t
>    smooth-scrolling-mode: t
>    show-smartparens-global-mode: t
>    smartparens-global-mode: t
>    show-paren-mode: t
>    savehist-mode: t
>    save-place-mode: t
>    rxt-global-mode: t
>    rxt-mode: t
>    recentf-mode: t
>    minibuffer-depth-indicate-mode: t
>    ido-vertical-mode: t
>    ido-ubiquitous-mode: t
>    icomplete-vertical-mode: t
>    global-whitespace-cleanup-mode: t
>    global-tree-sitter-mode: t
>    global-origami-mode: t
>    origami-mode: t
>    global-move-dup-mode: t
>    move-dup-mode: t
>    global-magit-file-mode: t
>    which-function-mode: t
>    magit-auto-revert-mode: t
>    global-auto-revert-mode: t
>    global-git-commit-mode: t
>    shell-dirtrack-mode: t
>    server-mode: t
>    global-hl-line-mode: t
>    global-flycheck-mode: t
>    global-diff-hl-mode: t
>    flx-ido-mode: t
>    ido-everywhere: t
>    icomplete-mode: t
>    fido-mode: t
>    editorconfig-mode: t
>    desktop-save-mode: t
>    delete-selection-mode: t
>    company-statistics-mode: t
>    global-company-mode: t
>    auto-compile-on-save-mode: t
>    async-bytecomp-package-mode: t
>    amx-mode: t
>    tooltip-mode: t
>    global-eldoc-mode: t
>    electric-indent-mode: t
>    mouse-wheel-mode: t
>    menu-bar-mode: t
>    file-name-shadow-mode: t
>    global-font-lock-mode: t
>    font-lock-mode: t
>    blink-cursor-mode: t
>    auto-composition-mode: t
>    auto-encryption-mode: t
>    auto-compression-mode: t
>    temp-buffer-resize-mode: t
>    buffer-read-only: t
>    size-indication-mode: t
>    column-number-mode: t
>    line-number-mode: t
>    transient-mark-mode: t
>
> Load-path shadows:
> /opt/local/share/emacs/site-lisp/cmake-mode hides /Users/wyuenho/.emacs.d/elpa/cmake-mode-20190710.1319/cmake-mode
> /Users/wyuenho/.emacs.d/elpa/xref-1.0.1/xref hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/progmodes/xref
> /Users/wyuenho/.emacs.d/elpa/project-0.5.0/project hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/progmodes/project
> /Users/wyuenho/.emacs.d/elpa/flymake-1.0.9/flymake hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/progmodes/flymake
> /Users/wyuenho/.emacs.d/elpa/eldoc-1.8.0/eldoc hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/emacs-lisp/eldoc
>
> Features:
> (undo-fu shadow sort mail-extr emacsbug sendmail tabify cl-print
> misearch multi-isearch visual-regexp-steroids visual-regexp autoload
> jka-compr helpful trace edebug info-look elisp-refs loop two-column
> all-the-icons all-the-icons-faces data-material data-weathericons
> data-octicons data-fileicons data-faicons data-alltheicons lsp-origami
> lsp-completion lsp-diagnostics lsp-modeline view lsp-sqls lsp-yaml
> lsp-xml lsp-vhdl lsp-vetur lsp-html lsp-verilog lsp-terraform
> lsp-solargraph lsp-serenata lsp-rust lsp-python-ms lsp-pyls lsp-pwsh
> lsp-perl lsp-json lsp-intelephense lsp-haxe lsp-go lsp-gdscript
> lsp-fsharp lsp-eslint lsp-erlang lsp-elm lsp-css lsp-csharp lsp-clojure
> lsp-clients dired-hide-dotfiles vc-mtn vc-hg vc-bzr vc-src vc-sccs
> vc-svn vc-cvs vc-rcs diff-hl-dired dired-collapse dired-hacks-utils
> company-web-html company-web company-css web-completion-data emmet-mode
> web-mode smart-semicolon add-node-modules-path css-mode smartparens-html
> sgml-mode eww mm-url gnus nnheader url-queue shr svg xml dom vc-git
> flycheck-pos-tip flycheck-pyre python-black py-isort python-docstring
> smartparens-python python tramp-sh docker-tramp tramp-cache tramp
> tramp-loaddefs trampver tramp-integration files-x tramp-compat ls-lisp
> projectile-rails rake inflections inf-ruby smartparens-ruby ruby-mode
> smie autoinsert projectile company-quickhelp pos-tip company-keywords
> company-etags etags fileloop generator company-gtags
> company-dabbrev-code company-dabbrev company-yasnippet company-capf
> company-emoji company-emoji-list company-files company-cmake
> company-xcode company-clang company-semantic company-eclim
> company-template rainbow-mode elisp-def ert debug backtrace
> display-line-numbers cap-words superword subword smartparens-config
> smartparens-javascript smartparens-org smartparens-markdown
> smartparens-text smartparens-c form-feed editorconfig-core
> editorconfig-core-handle editorconfig-fnmatch solarized-dark-theme
> solarized-theme solarized solarized-faces spaceline-config
> spaceline-segments spaceline powerline powerline-separators
> powerline-themes hideshow beginend window-purpose-x shut-up
> window-purpose window-purpose-fixes window-purpose-prefix-overload
> window-purpose-switch window-purpose-layout window-purpose-core
> window-purpose-configuration eieio-compat window-purpose-utils
> imenu-list windmove magit-lfs magit-todos hl-todo org ob ob-tangle
> ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
> org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp
> ob-core ob-eval org-table ol org-keys org-compat org-macs org-loaddefs
> cal-menu calendar cal-loaddefs forge-list forge-commands forge-semi
> forge-bitbucket buck forge-gogs gogs forge-gitea gtea forge-gitlab glab
> forge-github ghub-graphql treepy gsexp ghub let-alist forge-notify
> forge-revnote forge-pullreq forge-issue forge-topic bug-reference
> forge-post forge-repo forge forge-core forge-db closql emacsql-sqlite
> emacsql emacsql-compiler diff-hl-flydiff ediff-merg ediff-mult
> ediff-wind ediff-diff ediff-help ediff-init ediff-util dumb-jump popup
> rg rg-info-hack rg-menu rg-ibuffer rg-result wgrep-rg wgrep rg-history
> rg-header ibuf-ext ibuffer ibuffer-loaddefs grep swift-mode
> swift-mode-imenu swift-mode-repl swift-mode-beginning-of-defun
> swift-mode-font-lock swift-mode-standard-types swift-mode-indent
> swift-mode-lexer yard-mode poly-markdown polymode poly-lock
> polymode-base polymode-weave polymode-export polymode-compat
> polymode-methods polymode-core polymode-classes eieio-custom eieio-base
> json-mode json-reformat json-snatcher js cc-mode cc-fonts cc-guess
> cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
> reformatter parse-time iso8601 flycheck-objc-clang cl-lib-highlight
> eterm-256color term disp-table ehelp xterm-color native-complete
> company-lsp company-flx dap-lldb dap-mouse dap-ui dap-ui-repl
> lsp-treemacs lsp-treemacs-themes treemacs treemacs-header-line
> treemacs-compatibility treemacs-mode treemacs-interface
> treemacs-extensions treemacs-persistence treemacs-mouse-interface
> treemacs-tag-follow-mode treemacs-filewatch-mode treemacs-tags
> treemacs-follow-mode treemacs-rendering treemacs-async
> treemacs-workspaces treemacs-dom treemacs-visuals
> treemacs-fringe-indicator treemacs-scope pulse treemacs-faces
> treemacs-icons treemacs-themes treemacs-core-utils pfuture ace-window
> avy treemacs-logging treemacs-customization treemacs-macros gdb-mi gud
> bui bui-list bui-info bui-entry bui-core bui-history bui-button
> bui-utils lsp-lens dap-python dap-mode posframe dap-overlays
> lsp-sourcekit lsp-jedi lsp lsp-mode lsp-protocol xref project spinner
> markdown-mode color noutline outline lv inline ht f em-glob esh-util
> dash-functional compile bindat tree-sitter-langs tree-sitter-langs-build
> tar-mode arc-mode archive-mode pp tree-sitter-hl yasnippet-snippets
> yasnippet crm-custom pager-default-keybindings pager browse-kill-ring
> delight use-package-bind-key use-package-delight osx-trash bind-key
> exec-path-from-shell quelpa-use-package use-package-core quelpa lisp-mnt
> help-fns radix-tree mm-archive gnutls network-stream url-http url-gw nsm
> url-cache url-auth url url-proxy url-privacy url-expand url-methods
> url-history url-cookie url-domsuf url-util mailcap winner which-key
> smooth-scrolling smartparens thingatpt paren savehist saveplace pcre2el
> rxt re-builder recentf tree-widget mb-depth ido-vertical-mode
> ido-completing-read+ memoize cus-edit wid-edit minibuf-eldef
> icomplete-vertical help-at-pt whitespace-cleanup-mode whitespace
> tree-sitter tree-sitter-load tree-sitter-cli tree-sitter-core
> tree-sitter-dyn tree-sitter-dyn-get dired-aux origami origami-parsers
> move-dup magit-submodule magit-obsolete magit-blame magit-stash
> magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
> magit-remote magit-commit magit-sequence magit-notes magit-worktree
> magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
> magit-status magit magit-repos magit-apply magit-wip magit-log
> which-func imenu magit-diff smerge-mode diff magit-core magit-autorevert
> autorevert filenotify magit-margin magit-transient magit-process
> magit-mode git-commit transient magit-git magit-section magit-utils crm
> log-edit message rmc puny dired dired-loaddefs format-spec rfc822 mml
> mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs
> text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
> rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
> mail-utils gmm-utils mailheader pcvs-util add-log with-editor cl-extra
> shell pcomplete comint ring server hl-line flycheck ansi-color find-func
> help-mode dash diff-hl vc-dir ewoc vc vc-dispatcher diff-mode easy-mmode
> flx-ido flx ido icomplete editorconfig desktop frameset delsel
> company-statistics company pcase auto-compile packed async-bytecomp
> advice async amx s cus-start cus-load finder-inf edmacro kmacro rx cl
> info package easymenu browse-url url-handlers url-parse auth-source
> cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json
> subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv
> cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
> lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
> term/common-win tool-bar dnd fontset image regexp-opt fringe
> tabulated-list replace newcomment text-mode elisp-mode lisp-mode
> prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
> select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
> term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
> misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
> cp51932 hebrew greek romanian slovak czech european ethiopic indian
> cyrillic chinese composite charscript charprop case-table epa-hook
> jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
> button faces cus-face macroexp files text-properties overlay sha1 md5
> base64 format env code-pages mule custom widget hashtable-print-readable
> backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process
> emacs)
>
> Memory information:
> ((conses 16 1421509 540949)
>   (symbols 48 65724 54)
>   (strings 32 321417 88062)
>   (string-bytes 1 8900750)
>   (vectors 16 226691)
>   (vector-slots 8 5366473 762388)
>   (floats 8 1135 2969)
>   (intervals 56 11183 4313)
>   (buffers 1000 64))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42733; Package emacs. (Fri, 07 Aug 2020 02:19:01 GMT) Full text and rfc822 format available.

Message #11 received at 42733 <at> debbugs.gnu.org (full text, mbox):

From: soyeomul <at> doraji.xyz (황병희)
To: 42733 <at> debbugs.gnu.org
Subject: Re: bug#42733: 27.1;
 json-serialize does not encode list like json-encode
Date: Fri, 07 Aug 2020 11:18:25 +0900
Jimmy Yuen Ho Wong <wyuenho <at> gmail.com> writes:

> ...
>> Reproduction:
>>
>> (json-encode '("foo" "bar"))
>> => "[\"foo\",\"bar\"]"
>>
>> (json-serialize '("foo" "bar"))
>>
>> Debugger entered--Lisp error: (wrong-type-argument symbolp "foo")
>>    json-serialize(("foo" "bar"))
>>
>> The potential for people to naively substitute json-encode with
>> json-serialize and breaking their code is enormous. This is already
>> happening in lsp-mode. Please make json-serialize behave like
>> json-encode.
>>
>> Jimmy Yuen Ho Wong

I just would like to raise up this PR because i like very much JSON things. 

So thanks for Jimmy, indeed...!!!

Sincerely, JSON fan Byung-Hee

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42733; Package emacs. (Sat, 12 Jun 2021 12:54:02 GMT) Full text and rfc822 format available.

Message #14 received at 42733 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>
Cc: 42733 <at> debbugs.gnu.org, Philipp Stephani <phst <at> google.com>
Subject: Re: bug#42733: 27.1; json-serialize doesn't not encode list like
 json-encode
Date: Sat, 12 Jun 2021 14:53:41 +0200
Jimmy Yuen Ho Wong <wyuenho <at> gmail.com> writes:

> (json-encode '("foo" "bar"))
> => "[\"foo\",\"bar\"]"
>
> (json-serialize '("foo" "bar"))
>
> Debugger entered--Lisp error: (wrong-type-argument symbolp "foo")
>   json-serialize(("foo" "bar"))
>
> The potential for people to naively substitute json-encode with
> json-serialize and breaking their code is enormous. This is already
> happening in lsp-mode. Please make json-serialize behave like
> json-encode.

json.c is a lot less "DWIM" than json.el -- which I think is generally a
good idea when it comes to doing round-trips between Elisp and JSON,
because you avoid a lot of corner cases.

So I'd be inclined to just regard this as a feature, but I've added
Philipp to the CCs -- perhaps he has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 12 Jun 2021 12:54:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42733; Package emacs. (Mon, 05 Jul 2021 17:46:01 GMT) Full text and rfc822 format available.

Message #19 received at 42733 <at> debbugs.gnu.org (full text, mbox):

From: Philipp <p.stephani2 <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 42733 <at> debbugs.gnu.org, Philipp Stephani <phst <at> google.com>,
 Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>
Subject: Re: bug#42733: 27.1; json-serialize doesn't not encode list like
 json-encode
Date: Mon, 5 Jul 2021 19:45:19 +0200

> Am 12.06.2021 um 14:53 schrieb Lars Ingebrigtsen <larsi <at> gnus.org>:
> 
> Jimmy Yuen Ho Wong <wyuenho <at> gmail.com> writes:
> 
>> (json-encode '("foo" "bar"))
>> => "[\"foo\",\"bar\"]"
>> 
>> (json-serialize '("foo" "bar"))
>> 
>> Debugger entered--Lisp error: (wrong-type-argument symbolp "foo")
>>  json-serialize(("foo" "bar"))
>> 
>> The potential for people to naively substitute json-encode with
>> json-serialize and breaking their code is enormous. This is already
>> happening in lsp-mode. Please make json-serialize behave like
>> json-encode.
> 
> json.c is a lot less "DWIM" than json.el -- which I think is generally a
> good idea when it comes to doing round-trips between Elisp and JSON,
> because you avoid a lot of corner cases.
> 
> So I'd be inclined to just regard this as a feature, but I've added
> Philipp to the CCs -- perhaps he has some comments.

What Lars said.  In general, DWIM can be a good choice for high-level user-facing commands, but not for lower-level library functions like this.  Second-guessing the intention of the caller often generates surprising or subtly wrong results, which isn't what you want for interpreting a rather low-level protocol like JSON.  json-serialize thus very intentionally behaves differently than the json.el functions.



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42733; Package emacs. (Mon, 05 Jul 2021 19:49:01 GMT) Full text and rfc822 format available.

Message #22 received at 42733 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Philipp <p.stephani2 <at> gmail.com>
Cc: 42733 <at> debbugs.gnu.org, Philipp Stephani <phst <at> google.com>,
 Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>
Subject: Re: bug#42733: 27.1; json-serialize doesn't not encode list like
 json-encode
Date: Mon, 05 Jul 2021 21:48:11 +0200
Philipp <p.stephani2 <at> gmail.com> writes:

>> So I'd be inclined to just regard this as a feature, but I've added
>> Philipp to the CCs -- perhaps he has some comments.
>
> What Lars said.  In general, DWIM can be a good choice for high-level
> user-facing commands, but not for lower-level library functions like
> this.  Second-guessing the intention of the caller often generates
> surprising or subtly wrong results, which isn't what you want for
> interpreting a rather low-level protocol like JSON.  json-serialize
> thus very intentionally behaves differently than the json.el
> functions.

So this works as intended, and I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 05 Jul 2021 19:49:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 42733 <at> debbugs.gnu.org and Jimmy Yuen Ho Wong <wyuenho <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 05 Jul 2021 19:49:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 03 Aug 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 267 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.