LoginSignup
1
1

More than 5 years have passed since last update.

Node.js+Express.js でformの中身がjsonで取得できない時

Last updated at Posted at 2016-08-11

なぜかこうなった時は、

input.form-control(type="text",name="values[][customer_id]", placeholder="Customer ID")
input.form-control(type="text",name="values[][customer_name]", placeholder="Name")
input.form-control(type="text",name="values[][customer_email]", placeholder="email")
{"values[1][customer_id]":"a",
 "values[1][customer_name]":"b",
 "values[1][customer_email]":"c"}

ここが原因ぽかった。

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

falseをtrueにしたら解決。

{"values":[
 {"customer_id":"a",
  "customer_name":"b",
  "customer_email":"c"}
]}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1