Invalid UTF-8 JSON creating empty documents in Chapter 5 #472

Open
mikemil opened this Issue Sep 28, 2012 · 0 comments

Comments

Projects
None yet
1 participant
@mikemil

mikemil commented Sep 28, 2012

I encountered the 'Invalid UTF-8 JSON' error when trying to follow the instructions for creating an empty document. Then I decided to add a field and value. After getting the error again, I started looking at the reported issues and found #244 but either I am doing it wrong or it doesn't work. Yes, I am running on Window XP.

Below is a copy from my cmd prompt:

d:\java>curl -X POST http://127.0.0.1:5984/basic -d '{}' -H "Content-Type: application/json"
{"error":"bad_request","reason":"invalid UTF-8 JSON"}

d:\java>curl -X POST http://127.0.0.1:5984/basic -d '{"field" : "value"}' -H "Content-Type: application/json"
{"error":"bad_request","reason":"invalid UTF-8 JSON"}
curl: (56) Recv failure: Connection was reset
curl: (3) [globbing] unmatched close brace/bracket at pos 6

d:\java>curl -X POST http://127.0.0.1:5984/basic -d '{field : "value"}' -H "Content-Type: application/json"
{"error":"bad_request","reason":"invalid UTF-8 JSON"}
curl: (56) Recv failure: Connection was reset
curl: (3) [globbing] unmatched close brace/bracket at pos 8

d:\java>curl -X POST http://127.0.0.1:5984/basic -d '{"field" : "value"}' -H "Content-Type: application/json"
{"error":"bad_request","reason":"invalid UTF-8 JSON"}
curl: (56) Recv failure: Connection was reset
curl: (3) [globbing] unmatched close brace/bracket at pos 8

Okay - just resolved this problem by removing the single quotes around the empty json '{}' became just {} and it worked (on Windows).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment