Skip to content

Invalid json result when using curl under Windows #533

Open
@jackeisenbach

Description

@jackeisenbach

In CouchDB The Definitive Guide,
In the Core API section, under Documents, when you run the command:
curl -X PUT http://127.0.0.1:5984/albums/6e1295ed6c29495e54cc05947f18c8af -d '{"title":"There is Nothing Left to Lose","artist":"Foo Fighters"}'

I always got: {"error":"bad_request","reason":"invalid_json"}

It took a LONG time to debug. Under Windows 7 command shell, the Quotes in JSON need to be escaped differently using curl. Here's what worked for me:

c:>curl -X PUT http://127.0.0.1:5984/albums/6e1295ed6c29495e54cc05947f18c8af -d "{"""title""":"""There is Nothing Left to Lose""","""artist""":"""Foo Fighters"""}"

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