correct
curl -X PUT http://192.168.1.30:5984/visibox001/320097b898660a878ea81a96de9f49310 -d '{"title":"There is Nothing Left to Lose", "artist":"Foo Fighters"}'
{"ok":true,"id":"320097b898660a878ea81a96de9f49310","rev":"1-4b39c2971c9ad54cb37e08fa02fec636"}


wrong
curl -X PUT http://192.168.1.30:5984/visibox001/320097b898660a878ea81a96de9f49310 -d '{"title":"There is Nothing Left to Lose" "artist":"Foo Fighters"}'
{"error":"bad_request","reason":"invalid UTF-8 JSON"}

put a comma between key:value pairs and it will not be invalid

Søren Hilmer wrote:
In case it helps this is what CouchDb logs, when in debug mode (again this is done from futon: just doing "New Document" then "Save Document".
[debug] [<0.122.0>] 'PUT' /fgdf/8786346d0f34a1fb29d7e9d49b1cd141 {1,1}
Headers: [{'Accept',"application/json, text/javascript, */*"},
          {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
          {'Accept-Encoding',"gzip,deflate,sdch"},
          {'Accept-Language',"en-US,en;q=0.8"},
          {'Connection',"keep-alive"},
          {'Content-Length',"42"},
          {'Content-Type',"application/json"},
          {'Host',"localhost:5984"},
          {"Origin","http://localhost:5984"},
          {'Referer',"http://localhost:5984/_utils/document.html?fgdf"},
{'User-Agent',"Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.260.0 Safari/532.5"},
          {"X-Requested-With","XMLHttpRequest"}]
[debug] [<0.122.0>] OAuth Params: []
[error] [<0.122.0>] attempted upload of invalid JSON {"_id":"8786346d0f34a1fb29d7e9d49b1cd141"} [info] [<0.122.0>] 127.0.0.1 - - 'PUT' /fgdf/8786346d0f34a1fb29d7e9d49b1cd141 400
[debug] [<0.122.0>] httpd 400 error response:
 {"error":"bad_request","reason":"invalid UTF-8 JSON"}

--Søren

On Saturday 12 December 2009 08:01:49 Søren Hilmer wrote:
I get this as well. I am not on Windows and I also get it from Futon
No matter how simple the document (_id only) I try to add from Futon it
reponds with that errror.

I'am on:
   KUbuntu Jaunty.
   Apache CouchDB 0.11.0b889892
   Erlang R13B03 (erts-5.7.4)

Any clues?

--Søren

On Tuesday 08 December 2009 15:56:28 Stefan Fischer wrote:
Hi,



after playing with couchdb 0.10 examples:





command:

curl -X PUT
http://xxxx.xxx.xxx:5984/albums/6e1295ed6c29495e54cc05947f18c8af -d
'{"title":"There is Nothing Left to Lose" "artist":"Foo Fighters"}'



I get the following error:



{"error":"bad_request","reason":"invalid UTF-8 JSON"}





Whats wrong,



How to fix it ?



Thanks,

SF



Reply via email to