unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Improving JSON pretty printing, how to represent floats?
@ 2024-04-05  9:39 Herman, Géza
  2024-04-05 12:35 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Herman, Géza @ 2024-04-05  9:39 UTC (permalink / raw)
  To: emacs-devel

Hi,

I'm thinking about using the new JSON parser and encoder for 
json-pretty-print.

There is a thing that I don't like about the current 
json-pretty-print: as it parses floats, pretty printing can be 
lossy.  If one pretty prints this

--8<---------------cut here---------------start------------->8---
{
    "a": 3.333333333333000000000000000001
}
--8<---------------cut here---------------end--------------->8---

then the float gets rounded.  I think pretty printing should be 
lossless (keeping the exact format, exp notation, etc.).

What would be the best representation for numbers in this case? 
I'm thinking about using symbols, but I'm not sure this is the 
best approach.  The parser/encoder would have a new keyword 
parameter, like ":numbers-as-symbols t".  If this is specified, 
then numbers wouldn't be parsed, but kept as symbols.  What do you 
think, is this a good approach?

Geza



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

end of thread, other threads:[~2024-04-05 16:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05  9:39 Improving JSON pretty printing, how to represent floats? Herman, Géza
2024-04-05 12:35 ` Eli Zaretskii
2024-04-05 12:53   ` Mattias Engdegård
2024-04-05 12:55   ` Herman, Géza
2024-04-05 13:09     ` Eli Zaretskii
2024-04-05 13:16       ` Herman, Géza
2024-04-05 14:01         ` tomas
2024-04-05 15:34         ` Eli Zaretskii
2024-04-05 16:46           ` Herman, Géza
2024-04-05 13:37 ` Dmitry Gutov
2024-04-05 14:20   ` Herman, Géza
2024-04-05 16:47     ` Dmitry Gutov
2024-04-05 14:18 ` Mattias Engdegård
2024-04-05 14:25   ` Herman, Géza

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).