req.body { my_obj: { var1: [ [Obje."/> req.body { my_obj: { var1: [ [Obje."/> req.body { my_obj: { var1: [ [Obje"/>
خرید بک لینک

Vote count: 0

I'm using express-xml-bodyparser in NodeJs and I have this in app.post("/fdsfdsfds", function (req, res, nxt)

  > req.body
  { my_obj: { var1: [ [Object] ] } }
  > req.body.my_obj
  { var1: 
     [ { var2: [Object],
         var3: [Object],
         var1_code: [Object],
         email: [Object] } ] }


  > req.body.my_obj.var1
  [ { var2: [ [Object] ],
      var3: [ 'fdsfdsfdsfds' ],
      var1_code: [ '14' ],
      var4: [ 'test2' ],
      useame: [ [Object] ],
      email: [ 'fdsfdsfds' ] } ]

  > req.body.my_obj.var1[0]
  { var2: [ { '$': [Object] } ],
    var3: [ 'fdsfdsfdsfds' ],
    var1_code: [ '14' ],
    var4: [ 'test2' ],
    useame: [ { '$': [Object] } ],
    email: [ 'fdsfdsfds' ] }

I want to insert it into a db, therefore I have to create a dictionary. Is there any way to do that easily from what I have? This object has plenty of nested and redundant properties. As one of the options, I want to unfold them.

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 10 اسفند 1394 ساعت: 21:35

صفحه بندی