Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.031 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'json': 0.07; 'cc:addr :python-list': 0.11; 'emit': 0.16; 'nan': 0.16; 'semantically': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'trying': 0.19; 'seems': 0.21; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In- Reply-To:1': 0.27; "i'm": 0.30; 'that.': 0.31; 'there': 0.35; 'charset:us-ascii': 0.36; 'represent': 0.38; 'no.': 0.61; 'simply': 0.61; 'more': 0.64; 'to:addr:gmail.com': 0.65; '2013,': 0.91 Date: Thu, 18 Apr 2013 08:53:54 -0500 (CDT) From: Wayne Werner X-X-Sender: wayne@gilgamesh To: Miki Tebeka Subject: Re: Encoding NaN in JSON In-Reply-To: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1366293244 news.xs4all.nl 2233 [2001:888:2000:d::a6]:43782 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43829 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... -W