remy / jsonbin

A personal JSON store as a RESTful service
https://jsonbin.org
393 stars 25 forks source link

Parsing issues with arrays #34

Closed jpambrun closed 6 years ago

jpambrun commented 6 years ago
curl -X POST https://jsonbin.org/jpambrun/regression -H 'authorization: token XXXX' -d '[{"obj":1},{"obj":[123, 134]}]'

yields :

{
  "[{\"obj\":1},{\"obj\":": {
    "123, 134": ""
  }
}

However, JSON.parse('[{"obj":1},{"obj":[123, 134]}]') in the browser works perfectly fine.

remy commented 6 years ago

You need to send the content type header

jpambrun commented 6 years ago

Thanks. That indeed worked.

When testing/evaluating this project, I simply copy-pasted the example curl changing the -d option to @myusefulfile.json without thinking too much. I think you should consider adding the missing -H 'Content-Type: application/json' to the readme.