From user-return-19417-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Tue Jan 10 09:46:35 2012 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 08CAABFF2 for ; Tue, 10 Jan 2012 09:46:34 +0000 (UTC) Received: (qmail 16223 invoked by uid 500); 10 Jan 2012 09:38:14 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 14762 invoked by uid 500); 10 Jan 2012 09:37:28 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 14158 invoked by uid 99); 10 Jan 2012 09:32:02 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2012 09:32:02 +0000 Received: from localhost (HELO mail-iy0-f180.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2012 09:32:01 +0000 Received: by iadk27 with SMTP id k27so738003iad.11 for ; Tue, 10 Jan 2012 01:32:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.180.138 with SMTP id do10mr1706012igc.20.1326187921165; Tue, 10 Jan 2012 01:32:01 -0800 (PST) Received: by 10.42.243.67 with HTTP; Tue, 10 Jan 2012 01:32:01 -0800 (PST) In-Reply-To: References: Date: Tue, 10 Jan 2012 09:32:01 +0000 Message-ID: Subject: Re: i have a bulk insert problem about invalid json From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable try --data-binary instead of -d, perhaps you have some characters that are being converted incorrectly to ascii. B. On 10 January 2012 09:11, Zekeriya KO=C7 wrote: > Sorry for subjectless message!!! > > Hello, > > my problem: i am trying to insert approximately 255000 documents to a > > couchdb instance with bulk docs api. i always get invalid json > error. > > so i am trying to test =A0the problem with just one document. because > the error raises wether with a large file or a file with just one > document. > > my system: > couchdb: on an ubuntu server 10.04 > client: windows 7 with cygwin curl > > $ curl -X GET http://admin:ad... > @10.81.2.100:5984 > {"couchdb":"Welcome","version":"1.1.0","vendor": > {"version":"1.2.0","name":"Couchbase","url":"http:// > www.couchbase.com/ > "}} > > $ curl -d @test.txt -H "Content-Type:application/json" -X POST > http://admin:ad... > @10.81.2.100:5984/dbmerkez/_bulk_docs > {"error":"bad_request","reason":"invalid UTF-8 JSON: <<\"\ufeff{\\ > \"docs\\\":[{\\\"adi\\\": \\\"zeko\\\"}]}\">>"} > > now i copy the content of test.txt and paste it to my command line: > $ curl -d '{"docs":[{"adi": "zeko"}]}' -H "Content-Type:application/ > json" -X POST http://admin:ad... > @10.81.2.100:5984/dbmerkez/_bulk_docs > [{"id":"74a5d37e71215e2095d00f90a00007ac","rev":"1-111c10804ee9f2b8384ab9= 5e > f66268e0"}] > > as you can see same content gives an invalid json error within a file > but from direct command line it inserts fine. > > my text file is encoded in utf-8. > > i am so close to give up. i am fighting with this for hours. if i can > not insert initial data to my instance i can not test the replication > cases. > > please help!! > > -- > Zekeriya "zekUs" KO=C7 - http://zekzekus.com/ > > > > -- > Zekeriya "zekUs" KO=C7 - http://zekzekus.com/