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 C1D80B961 for ; Tue, 10 Jan 2012 10:56:42 +0000 (UTC) Received: (qmail 18430 invoked by uid 500); 10 Jan 2012 10:45:56 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 18368 invoked by uid 500); 10 Jan 2012 10:45:44 -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 18317 invoked by uid 99); 10 Jan 2012 10:45:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2012 10:45:41 +0000 X-ASF-Spam-Status: No, hits=0.4 required=5.0 tests=FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of cgsmcmlxxv@gmail.com designates 74.125.83.52 as permitted sender) Received: from [74.125.83.52] (HELO mail-ee0-f52.google.com) (74.125.83.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2012 10:45:33 +0000 Received: by eekc14 with SMTP id c14so172946eek.11 for ; Tue, 10 Jan 2012 02:45:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=C6NHWQhuA7J9PfmcXC/DEvMKQRWkhbiK+GhRMdqmnJY=; b=Mn5vojo+iXqAJhLr/HaSCzLokKCGX/v+mvorzPVivU3vuRsuce2Y5DEGcscZeCDYvV F1GhJr0hEfL06DGtJIHLV0wmJMMt/MWVjh3drtjyiyctwvSfO2Jx0y3CRxJRNs8w4SgP xLuA45PHSls2Ibxes39efElYuU5GcXlxGh6lc= Received: by 10.14.9.228 with SMTP id 76mr7584871eet.30.1326192312796; Tue, 10 Jan 2012 02:45:12 -0800 (PST) Received: from [192.168.1.103] (095160203004.wroclaw.vectranet.pl. [95.160.203.4]) by mx.google.com with ESMTPS id 19sm126731597eew.7.2012.01.10.02.45.11 (version=SSLv3 cipher=OTHER); Tue, 10 Jan 2012 02:45:11 -0800 (PST) Message-ID: <4F0C16B5.3080604@gmail.com> Date: Tue, 10 Jan 2012 11:45:09 +0100 From: CGS User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Re: i have a bulk insert problem about invalid json References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, With 255000 documents in one session, you go over the number of the characters allowed either for a prompter command or for a HTTP request (if not for both). The session truncates the command, so, your JSON is incomplete. That gave me that response in the past. CGS On 01/10/2012 10:11 AM, Zekeriya KOÇ 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 the 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-111c10804ee9f2b8384ab95e > 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!! >