Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43933

Re: Encoding NaN in JSON

From Grant Edwards <invalid@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: Encoding NaN in JSON
Date 2013-04-19 19:42 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <kks6np$mvt$1@reader1.panix.com> (permalink)
References (1 earlier) <k4dsm8dea0gi3gf689p94el7gc6b1vk4bh@4ax.com> <c37a3b9c-6fe8-48aa-b703-9b4f922c3969@googlegroups.com> <mailman.770.1366293244.3114.python-list@python.org> <kkrlr4$brs$1@reader1.panix.com> <mailman.836.1366395732.3114.python-list@python.org>

Show all headers | View raw


On 2013-04-19, Chris ???Kwpolska??? Warrick <kwpolska@gmail.com> wrote:
> On Fri, Apr 19, 2013 at 4:54 PM, Grant Edwards <invalid@invalid.invalid> wrote:
>> On 2013-04-18, Wayne Werner <wayne@waynewerner.com> wrote:
>>> On Wed, 17 Apr 2013, Miki Tebeka wrote:
>>>
>>>>>> I'm trying to find a way to have json emit float('NaN') as 'N/A'.
>>>>> No.  There is no way to represent NaN in JSON.  It's simply not part of the
>>>>> specification.
>>>> I know that. I'm trying to emit the *string* 'N/A' for every NaN.
>>>
>>> Why not use `null` instead? It seems to be semantically more similar...
>>
>> Why not use 'NaN' instead? It seems to be even more semantically
>> similar...
>
> Because there is no NaN in JSON?  Unless you mean a string, which
> makes no semantical sense and is human-oriented and not
> machine-oriented.

The OP asked for a string, and I thought you were proposing the string
'null'.  If one is to use a string, then 'NaN' makes the most sense,
since it can be converted back into a floating point NaN object.

I infer that you were proposing a JSON null value and not the string
'null'?

-- 
Grant Edwards               grant.b.edwards        Yow! I'm receiving a coded
                                  at               message from EUBIE BLAKE!!
                              gmail.com            

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Encoding NaN in JSON Miki Tebeka <miki.tebeka@gmail.com> - 2013-04-16 17:21 -0700
  Re: Encoding NaN in JSON Tim Roberts <timr@probo.com> - 2013-04-16 22:38 -0700
    Re: Encoding NaN in JSON Miki Tebeka <miki.tebeka@gmail.com> - 2013-04-17 07:33 -0700
      Re: Encoding NaN in JSON John Gordon <gordon@panix.com> - 2013-04-17 14:47 +0000
      Re: Encoding NaN in JSON Johann Hibschman <jhibschman@gmail.com> - 2013-04-17 14:05 -0500
        Re: Encoding NaN in JSON Miki Tebeka <miki.tebeka@gmail.com> - 2013-04-17 14:21 -0700
          Re: Encoding NaN in JSON Roland Koebler <r.koebler@yahoo.de> - 2013-04-18 00:40 +0200
            Re: Encoding NaN in JSON Miki Tebeka <miki.tebeka@gmail.com> - 2013-04-17 18:01 -0700
              Re: Encoding NaN in JSON Roland Koebler <r.koebler@yahoo.de> - 2013-04-18 03:39 +0200
              Re: Encoding NaN in JSON Chris Angelico <rosuav@gmail.com> - 2013-04-18 11:41 +1000
              Re: Encoding NaN in JSON Chris Angelico <rosuav@gmail.com> - 2013-04-18 11:46 +1000
              Re: Encoding NaN in JSON Roland Koebler <r.koebler@yahoo.de> - 2013-04-18 10:11 +0200
        Re: Encoding NaN in JSON Dave Angel <d@davea.name> - 2013-04-17 17:37 -0400
      Re: Encoding NaN in JSON Wayne Werner <wayne@waynewerner.com> - 2013-04-18 08:53 -0500
        Re: Encoding NaN in JSON Grant Edwards <invalid@invalid.invalid> - 2013-04-19 14:54 +0000
          Re: Encoding NaN in JSON Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-04-19 20:21 +0200
            Re: Encoding NaN in JSON Grant Edwards <invalid@invalid.invalid> - 2013-04-19 19:42 +0000
              Re: Encoding NaN in JSON Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-04-20 10:00 +0200
              Re: Encoding NaN in JSON Wayne Werner <wayne@waynewerner.com> - 2013-04-22 13:53 -0500
      Re: Encoding NaN in JSON Tim Roberts <timr@probo.com> - 2013-04-18 22:04 -0700
        Re: Encoding NaN in JSON Robert Kern <robert.kern@gmail.com> - 2013-04-19 11:43 +0530
          Re: Encoding NaN in JSON Miki Tebeka <miki.tebeka@gmail.com> - 2013-04-19 12:52 -0700

csiph-web