incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject Re: Incremental map/reduce
Date Sat, 31 Jan 2009 17:56:34 GMT
On Fri, Jan 30, 2009 at 08:56:25PM +0530, Niket Patel wrote:
> It have script in python and ruby to get pretty output form curl
> and about \n at end of response also discussed previously aggressively 
> :-)

OK, I see that in the thread you reference.

Noah wrote:

| This proposal could go two ways:
| * CouchDB consistently omits the trailing newline from text files
| * CouchDB consistently adds the trailing newline to text files
| Where "file" is a reference to the HTTP response entity-body with a media
| type of application/json, which is in turn a text based format.

I think there is a third option: Couchdb consistently adds a newline to the
end of any JSON-encoded text which *it* generates.

Arguments about cryptographic signatures are moot: Couchdb does not store
the JSON document it receives, byte-for-byte as-is. It parses it into some
internal data structure, and then encodes that data structure back into
JSON. White-space is not preserved; and an example was posted a few days ago
showing a unicode character being converted into its \uxxxx form.

The thread ended with Chris Anderson writing:

| I'm not absolutely certain of the merits in this case, but as long as we're
| consistent I don't see the harm in adding newlines to JSON output. There's
| nothing in the JSON RFC that says we can't.
| I've added a ticket and a patch for when we decide which way to go:

and JIRA remains marked "Please discuss (again, sorry)"

So, for what it's worth, I add my +1 to adding a trailing newline to
Couchdb-generated JSON.



View raw message