Skip to content

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

Open
@mikemil

Description

@mikemil

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions