unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42994: 27.1; json-serialize unable to serialize JSON values
@ 2020-08-23 12:24 Jimmy Yuen Ho Wong
  2020-08-23 12:53 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Jimmy Yuen Ho Wong @ 2020-08-23 12:24 UTC (permalink / raw)
  To: 42994


According to the [JSON spec](https://www.json.org/json-en.html),
everything is a value and every value is a valid JSON, which means
literal string, numbers, and true, false and null are also valid JSON
values, but `json-serialize` is unable to serialize literals. This is
wrong and behaviorialy different from the elisp-based `json-encode`.


In GNU Emacs 27.1 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.6 (Build 19G2021))
 of 2020-08-16 built on MobileCat.local
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.6

Recent messages:
Entering debugger...
Back to top level
Entering debugger...
Back to top level
Saving file /Users/wyuenho/.emacs.d/elpa/lsp-mode-20200822.1926/lsp-eslint.el...
Wrote /Users/wyuenho/.emacs.d/elpa/lsp-mode-20200822.1926/lsp-eslint.el
Generating autoloads for /Users/wyuenho/.emacs.d/elpa/lsp-mode-20200822.1926/lsp-eslint.el...done
Saving file /Users/wyuenho/.emacs.d/elpa/lsp-mode-20200822.1926/lsp-mode-autoloads.el...
Wrote /Users/wyuenho/.emacs.d/elpa/lsp-mode-20200822.1926/lsp-mode-autoloads.el
Wrote /Users/wyuenho/.emacs.d/elpa/lsp-mode-20200822.1926/lsp-eslint.el (byte-compiling failed)
"true"
Configured using:
 'configure --prefix=/opt/local --without-dbus --without-gconf
 --without-libotf --without-m17n-flt --with-gpm --with-gnutls
 --with-json --with-xml2 --with-modules --infodir
 /opt/local/share/info/emacs --with-ns --with-gif --with-jpeg
 --with-lcms2 --with-png --with-tiff --with-xpm --without-harfbuzz
 --without-imagemagick --without-rsvg --without-xaw3d --with-rsvg
 'CFLAGS=-pipe -Os
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch
 x86_64' 'CPPFLAGS=-I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk'
 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie
 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
 -arch x86_64''

Configured features:
RSVG 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: Emacs-Lisp

Minor modes in effect:
  flycheck-pos-tip-mode: t
  company-fuzzy-mode: t
  company-statistics-mode: t
  company-quickhelp-mode: t
  company-quickhelp-local-mode: t
  rainbow-mode: t
  elisp-def-mode: t
  display-line-numbers-mode: t
  subword-mode: t
  form-feed-mode: t
  beginend-prog-mode: t
  purpose-mode: t
  imenu-list-minor-mode: t
  diff-hl-flydiff-mode: t
  projectile-rails-global-mode: t
  dap-tooltip-mode: t
  dap-ui-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: deferred
  treemacs-fringe-indicator-mode: t
  dap-mode: t
  yas-minor-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
  show-smartparens-mode: t
  smartparens-global-mode: t
  smartparens-mode: t
  show-paren-mode: t
  savehist-mode: t
  save-place-mode: t
  rxt-global-mode: t
  rxt-mode: t
  recentf-mode: t
  poetry-tracking-mode: t
  projectile-mode: t
  minibuffer-depth-indicate-mode: t
  ido-vertical-mode: t
  ido-ubiquitous-mode: t
  icomplete-vertical-mode: t
  global-whitespace-cleanup-mode: t
  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
  diff-hl-mode: t
  global-company-mode: t
  company-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
  auto-compile-on-save-mode: t
  auto-compile-mode: t
  async-bytecomp-package-mode: t
  amx-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  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
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  visual-line-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.2/xref hides /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/progmodes/xref
/Users/wyuenho/.emacs.d/elpa/project-0.5.1/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:
(shadow sort mail-extr emacsbug sendmail jka-compr jsonrpc helpful trace
edebug info-look elisp-refs warnings cl-print iso-transl profiler
two-column eieio-opt speedbar sb-image ezimage dframe
visual-regexp-steroids visual-regexp misearch multi-isearch autoload
undo-fu expand-region subword-mode-expansions text-mode-expansions
cc-mode-expansions the-org-mode-expansions ruby-mode-expansions
python-el-fgallina-expansions js-mode-expansions er-basic-expansions
expand-region-core expand-region-custom 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 lsp-completion lsp-diagnostics lsp-modeline 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
company-fuzzy company-statistics 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-clang company-semantic company-template company-bbdb
rainbow-mode elisp-def ert debug backtrace display-line-numbers
cap-words superword subword smartparens-config smartparens-javascript
smartparens-ruby 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 gnutls 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 url-http url-auth url-gw 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 projectile-rails rake inflections
inf-ruby ruby-mode smie autoinsert 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 flycheck-objc-clang
cl-lib-highlight eterm-256color term disp-table ehelp xterm-color
native-complete company-lsp 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 dap-launch dap-variables posframe
dap-overlays lsp-sourcekit lsp-jedi lsp lsp-mode lsp-protocol xref
project spinner network-stream nsm markdown-mode color noutline outline
lv inline ht f dash-functional bindat tree-sitter-langs
tree-sitter-langs-build tar-mode arc-mode archive-mode url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap pp tree-sitter-hl yasnippet-snippets yasnippet
parse-time iso8601 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 winner which-key
smooth-scrolling smartparens paren savehist saveplace pcre2el rxt
re-builder recentf tree-widget poetry projectile grep compile ibuf-ext
ibuffer ibuffer-loaddefs thingatpt pyvenv eshell esh-cmd esh-ext esh-opt
esh-proc esh-io esh-arg esh-module esh-groups esh-util 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
company pcase flx-ido flx ido icomplete editorconfig desktop frameset
delsel 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 1236869 771381)
 (symbols 48 59754 2)
 (strings 32 260694 133068)
 (string-bytes 1 7820521)
 (vectors 16 170769)
 (vector-slots 8 3445026 490372)
 (floats 8 7257 9604)
 (intervals 56 44394 28183)
 (buffers 1000 76))





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2020-08-23 12:24 bug#42994: 27.1; json-serialize unable to serialize JSON values Jimmy Yuen Ho Wong
@ 2020-08-23 12:53 ` Eli Zaretskii
  2020-08-23 12:56   ` Jimmy Yuen Ho Wong
  2020-08-23 16:21 ` Drew Adams
  2021-02-13 13:40 ` Philipp
  2 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2020-08-23 12:53 UTC (permalink / raw)
  To: Jimmy Yuen Ho Wong; +Cc: 42994

> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> Date: Sun, 23 Aug 2020 13:24:58 +0100
> 
> 
> According to the [JSON spec](https://www.json.org/json-en.html),
> everything is a value and every value is a valid JSON, which means
> literal string, numbers, and true, false and null are also valid JSON
> values, but `json-serialize` is unable to serialize literals. This is
> wrong and behaviorialy different from the elisp-based `json-encode`.

Thank you for your report.  To allow us to process this issue quickly
and efficiently, please provide a couple of examples where
json-serialize is unable to serialize literals.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2020-08-23 12:53 ` Eli Zaretskii
@ 2020-08-23 12:56   ` Jimmy Yuen Ho Wong
  2020-08-23 14:05     ` Jimmy Yuen Ho Wong
  0 siblings, 1 reply; 14+ messages in thread
From: Jimmy Yuen Ho Wong @ 2020-08-23 12:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 42994

(json-serialize t) ;; *** Eval error ***  Wrong type argument: json-value-p, t
(json-serialize "foo") ;; *** Eval error ***  Wrong type argument:
json-value-p, "foo"
(json-serialize 1) ;; *** Eval error ***  Wrong type argument: json-value-p, 1

These are all valid JSONs.

On Sun, Aug 23, 2020 at 1:53 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> > Date: Sun, 23 Aug 2020 13:24:58 +0100
> >
> >
> > According to the [JSON spec](https://www.json.org/json-en.html),
> > everything is a value and every value is a valid JSON, which means
> > literal string, numbers, and true, false and null are also valid JSON
> > values, but `json-serialize` is unable to serialize literals. This is
> > wrong and behaviorialy different from the elisp-based `json-encode`.
>
> Thank you for your report.  To allow us to process this issue quickly
> and efficiently, please provide a couple of examples where
> json-serialize is unable to serialize literals.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2020-08-23 12:56   ` Jimmy Yuen Ho Wong
@ 2020-08-23 14:05     ` Jimmy Yuen Ho Wong
  0 siblings, 0 replies; 14+ messages in thread
From: Jimmy Yuen Ho Wong @ 2020-08-23 14:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 42994

The answer seems to be setting JSON_ENCODE_ANY and JSON_DECODE_ANY

https://jansson.readthedocs.io/en/latest/apiref.html#encoding
https://jansson.readthedocs.io/en/latest/apiref.html#decoding

On Sun, Aug 23, 2020 at 1:56 PM Jimmy Yuen Ho Wong <wyuenho@gmail.com> wrote:
>
> (json-serialize t) ;; *** Eval error ***  Wrong type argument: json-value-p, t
> (json-serialize "foo") ;; *** Eval error ***  Wrong type argument:
> json-value-p, "foo"
> (json-serialize 1) ;; *** Eval error ***  Wrong type argument: json-value-p, 1
>
> These are all valid JSONs.
>
> On Sun, Aug 23, 2020 at 1:53 PM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> > > Date: Sun, 23 Aug 2020 13:24:58 +0100
> > >
> > >
> > > According to the [JSON spec](https://www.json.org/json-en.html),
> > > everything is a value and every value is a valid JSON, which means
> > > literal string, numbers, and true, false and null are also valid JSON
> > > values, but `json-serialize` is unable to serialize literals. This is
> > > wrong and behaviorialy different from the elisp-based `json-encode`.
> >
> > Thank you for your report.  To allow us to process this issue quickly
> > and efficiently, please provide a couple of examples where
> > json-serialize is unable to serialize literals.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2020-08-23 12:24 bug#42994: 27.1; json-serialize unable to serialize JSON values Jimmy Yuen Ho Wong
  2020-08-23 12:53 ` Eli Zaretskii
@ 2020-08-23 16:21 ` Drew Adams
  2020-08-23 16:46   ` Jimmy Yuen Ho Wong
  2021-02-13 13:40 ` Philipp
  2 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2020-08-23 16:21 UTC (permalink / raw)
  To: Jimmy Yuen Ho Wong, 42994

> According to the [JSON spec]
> (https://www.json.org/json-en.html),
> everything is a value and every value is a valid JSON, which means
> literal string, numbers, and true, false and null are also valid JSON
> values, but `json-serialize` is unable to serialize literals. This is
> wrong and behaviorialy different from the elisp-based `json-encode`.

All JSON scalars are JSON values.

Whether a JSON scalar is sufficient for a document
(a JSON text) to be considered a JSON document
(aka text) depends on whether RFC 8259 is supported.

https://tools.ietf.org/html/rfc8259

When someone speaks of "a JSON", if they mean a
JSON text (aka document), then whether that RFC is
supported determines the status of a scalar value.

Prior to that RFC, and for applications/systems that
don't support it, only JSON objects and arrays need
be considered JSON texts.

Put differently, if only RFC 7159 or RFC 4627 is
supported, and not also RFC 8259, then a document
with just a scalar (which is a JSON _value_) isn't
necessarily considered a JSON document.

From RFC 8259:

   A JSON text is a serialized value.  Note that
   certain previous specifications of JSON
   constrained a JSON text to be an object or an
   array.  Implementations that generate only
   objects or arrays where a JSON text is called
   for will be interoperable in the sense that all
   implementations will accept these as conforming
   JSON texts.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2020-08-23 16:21 ` Drew Adams
@ 2020-08-23 16:46   ` Jimmy Yuen Ho Wong
  2020-08-23 16:58     ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Jimmy Yuen Ho Wong @ 2020-08-23 16:46 UTC (permalink / raw)
  To: Drew Adams, 42994


> All JSON scalars are JSON values.
>
> Whether a JSON scalar is sufficient for a document
> (a JSON text) to be considered a JSON document
> (aka text) depends on whether RFC 8259 is supported.
>
> https://tools.ietf.org/html/rfc8259
>
> When someone speaks of "a JSON", if they mean a
> JSON text (aka document), then whether that RFC is
> supported determines the status of a scalar value.
>
> Prior to that RFC, and for applications/systems that
> don't support it, only JSON objects and arrays need
> be considered JSON texts.
>
> Put differently, if only RFC 7159 or RFC 4627 is
> supported, and not also RFC 8259, then a document
> with just a scalar (which is a JSON _value_) isn't
> necessarily considered a JSON document.
>
>  From RFC 8259:
>
>     A JSON text is a serialized value.  Note that
>     certain previous specifications of JSON
>     constrained a JSON text to be an object or an
>     array.  Implementations that generate only
>     objects or arrays where a JSON text is called
>     for will be interoperable in the sense that all
>     implementations will accept these as conforming
>     JSON texts.

RFC 7159, a 6 years old RFC has that exact same language in your quote. 
That quote means any RFC 4627 JSON text is forward compatible with any 
JSON parsers conforming to RFC 7159 or RFC 8259 and nothing else.

I'm not sure why you are bringing this up. Even RFC 8259 is 3 years old 
and prior to that people had been sending booleans strings and numbers 
as JSON text for many years.






^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2020-08-23 16:46   ` Jimmy Yuen Ho Wong
@ 2020-08-23 16:58     ` Drew Adams
  2020-08-24  6:13       ` Jimmy Yuen Ho Wong
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2020-08-23 16:58 UTC (permalink / raw)
  To: Jimmy Yuen Ho Wong, 42994

> I'm not sure why you are bringing this up. Even RFC 8259 is 3 years old
> and prior to that people had been sending booleans strings and numbers
> as JSON text for many years.

I'm actually agreeing with you.

I brought it up to point out that at one time
JSON scalar values were typically not considered
to be JSON texts.  This explains why some systems,
frameworks, applications, etc. might not support
scalar serialization.

That's all.  I do believe that Emacs should
support RFC 8259 (it should always support the
latest JSON specs).  And it should support it
by default.

For interoperability with other systems etc. that
do not support scalar texts, it can be useful to
have a mode that, likewise, doesn't support/allow
scalars as JSON texts - e.g., a "disable scalars"
mode, which rejects a document that isn't an
object or an array.

But by default Emacs should support scalar texts.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2020-08-23 16:58     ` Drew Adams
@ 2020-08-24  6:13       ` Jimmy Yuen Ho Wong
  0 siblings, 0 replies; 14+ messages in thread
From: Jimmy Yuen Ho Wong @ 2020-08-24  6:13 UTC (permalink / raw)
  To: Drew Adams; +Cc: 42994

> For interoperability with other systems etc. that
> do not support scalar texts, it can be useful to
> have a mode that, likewise, doesn't support/allow
> scalars as JSON texts - e.g., a "disable scalars"
> mode, which rejects a document that isn't an
> object or an array.
>
> But by default Emacs should support scalar texts.

There's no need for any RFC modes. Decoding in Emacs with RFC 4627 is
pointless as there are already :null-object and :false-object to
enable translation of JSON values in elisp. Providing any kind of mode
for encoding is also pointless, as the author sending the JSON should
know what the other end expects. If the other side doesn't accept
scalars, it'll reject there, and the client author can adjust
accordingly.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2020-08-23 12:24 bug#42994: 27.1; json-serialize unable to serialize JSON values Jimmy Yuen Ho Wong
  2020-08-23 12:53 ` Eli Zaretskii
  2020-08-23 16:21 ` Drew Adams
@ 2021-02-13 13:40 ` Philipp
  2021-02-13 18:23   ` Basil L. Contovounesios
  2 siblings, 1 reply; 14+ messages in thread
From: Philipp @ 2021-02-13 13:40 UTC (permalink / raw)
  To: 42994-done

I’ve now fixed this with commit 625de7e403.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2021-02-13 13:40 ` Philipp
@ 2021-02-13 18:23   ` Basil L. Contovounesios
  2021-02-13 18:36     ` Philipp
  2021-02-13 23:30     ` bug#42994: [External] : " Drew Adams
  0 siblings, 2 replies; 14+ messages in thread
From: Basil L. Contovounesios @ 2021-02-13 18:23 UTC (permalink / raw)
  To: p.stephani2; +Cc: 42994, wyuenho

Philipp <p.stephani2@gmail.com> writes:

> I’ve now fixed this with commit 625de7e403.

Thanks!  Does this need calling out in etc/NEWS, or is it considered
more of a bugfix?

-- 
Basil





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: 27.1; json-serialize unable to serialize JSON values
  2021-02-13 18:23   ` Basil L. Contovounesios
@ 2021-02-13 18:36     ` Philipp
  2021-02-13 23:30     ` bug#42994: [External] : " Drew Adams
  1 sibling, 0 replies; 14+ messages in thread
From: Philipp @ 2021-02-13 18:36 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 42994, wyuenho



> Am 13.02.2021 um 19:23 schrieb Basil L. Contovounesios <contovob@tcd.ie>:
> 
> Philipp <p.stephani2@gmail.com> writes:
> 
>> I’ve now fixed this with commit 625de7e403.
> 
> Thanks!  Does this need calling out in etc/NEWS, or is it considered
> more of a bugfix?

Good point, I’ve now documented it in NEWS.  It’s definitely not a bugfix, since the previous behavior was intentional.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: [External] : bug#42994: 27.1; json-serialize unable to serialize JSON values
  2021-02-13 18:23   ` Basil L. Contovounesios
  2021-02-13 18:36     ` Philipp
@ 2021-02-13 23:30     ` Drew Adams
  2021-02-14  0:40       ` Jimmy Yuen Ho Wong
  1 sibling, 1 reply; 14+ messages in thread
From: Drew Adams @ 2021-02-13 23:30 UTC (permalink / raw)
  To: Basil L. Contovounesios, p.stephani2@gmail.com
  Cc: 42994@debbugs.gnu.org, wyuenho@gmail.com

> Thanks!  Does this need calling out in etc/NEWS, or is it considered
> more of a bugfix?

(Again, not really following this thread.)

If Emacs support of JSON parsing or serializing
changes from considering only objects and arrays
to be "jsons" to considering also JSON scalars
to be "jsons", then that's not a bug fix; it's
a change in support of the JSON language.  IMO,
that should be called out somewhere such as NEWS.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: [External] : bug#42994: 27.1; json-serialize unable to serialize JSON values
  2021-02-13 23:30     ` bug#42994: [External] : " Drew Adams
@ 2021-02-14  0:40       ` Jimmy Yuen Ho Wong
  2021-02-14 10:00         ` Philipp Stephani
  0 siblings, 1 reply; 14+ messages in thread
From: Jimmy Yuen Ho Wong @ 2021-02-14  0:40 UTC (permalink / raw)
  To: Drew Adams, Basil L. Contovounesios, p.stephani2@gmail.com
  Cc: 42994@debbugs.gnu.org

If the original intention for `json-serialize` was to offer a 
functionally equivalent native version of `json-encode`, then this is a 
bug. There was no discussion about this mismatch whatsover, so my guess 
is this was an omission and thus a bug.

On 13/02/2021 11:30 PM, Drew Adams wrote:
>> Thanks!  Does this need calling out in etc/NEWS, or is it considered
>> more of a bugfix?
> (Again, not really following this thread.)
>
> If Emacs support of JSON parsing or serializing
> changes from considering only objects and arrays
> to be "jsons" to considering also JSON scalars
> to be "jsons", then that's not a bug fix; it's
> a change in support of the JSON language.  IMO,
> that should be called out somewhere such as NEWS.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#42994: [External] : bug#42994: 27.1; json-serialize unable to serialize JSON values
  2021-02-14  0:40       ` Jimmy Yuen Ho Wong
@ 2021-02-14 10:00         ` Philipp Stephani
  0 siblings, 0 replies; 14+ messages in thread
From: Philipp Stephani @ 2021-02-14 10:00 UTC (permalink / raw)
  To: Jimmy Yuen Ho Wong; +Cc: Basil L. Contovounesios, 42994@debbugs.gnu.org

Am So., 14. Feb. 2021 um 01:40 Uhr schrieb Jimmy Yuen Ho Wong
<wyuenho@gmail.com>:
>
> If the original intention for `json-serialize` was to offer a
> functionally equivalent native version of `json-encode`, then this is a
> bug. There was no discussion about this mismatch whatsover, so my guess
> is this was an omission and thus a bug.

Yes, replicating json-encode was not the intention.

>
> On 13/02/2021 11:30 PM, Drew Adams wrote:
> >> Thanks!  Does this need calling out in etc/NEWS, or is it considered
> >> more of a bugfix?
> > (Again, not really following this thread.)
> >
> > If Emacs support of JSON parsing or serializing
> > changes from considering only objects and arrays
> > to be "jsons" to considering also JSON scalars
> > to be "jsons", then that's not a bug fix; it's
> > a change in support of the JSON language.  IMO,
> > that should be called out somewhere such as NEWS.





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-02-14 10:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23 12:24 bug#42994: 27.1; json-serialize unable to serialize JSON values Jimmy Yuen Ho Wong
2020-08-23 12:53 ` Eli Zaretskii
2020-08-23 12:56   ` Jimmy Yuen Ho Wong
2020-08-23 14:05     ` Jimmy Yuen Ho Wong
2020-08-23 16:21 ` Drew Adams
2020-08-23 16:46   ` Jimmy Yuen Ho Wong
2020-08-23 16:58     ` Drew Adams
2020-08-24  6:13       ` Jimmy Yuen Ho Wong
2021-02-13 13:40 ` Philipp
2021-02-13 18:23   ` Basil L. Contovounesios
2021-02-13 18:36     ` Philipp
2021-02-13 23:30     ` bug#42994: [External] : " Drew Adams
2021-02-14  0:40       ` Jimmy Yuen Ho Wong
2021-02-14 10:00         ` Philipp Stephani

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).