Q:

How to send simple object in cURL post request

I need to attach a simple object {foo:"bar"} to a x-www-form-urlencoded cURL post request.  Notice the metadata tag in the example below: How do you encode an object like that?  I realize it's not literal JSON, like I have in the request example below. 

curl https://api.stripe.com/v1/transfers \
    -u **********************: \
    -d currency=usd \
    -d description='This is a test' \
    -d destination=************* \
    -d metadata='{foo:"bar"}' \
    -d amount=200

I've also tried %7B'foo'%3A'bar'%7D and foo=bar
The Stripe API response is always:

{
  "error": {
    "type": "invalid_request_error",
    "message": "Invalid metadata: metadata must be a set of key-value pairs",
    "param": "metadata"
  }
}

A:

For anyone that has trouble with the nesting metadata, the answer is the following...
curl https://api.stripe.com/v1/transfers \
    -u ************: \
    -d currency=usd \
    -d description='This is a test' \
    -d destination=********* \
    -d metadata[foo]=bar \
    -d amount=200

