How to send array in advanced-rest-client and get it in node js app

207 views Asked by At

I test many things but I not arrive achieve this I arrive to send the array to backend but I not arrive to use it because i get string array this is a array

online_products [
{
  "name":"AMPICILLINE TM 20 mg Gel",
  "code":"74647293"
  "prix":"1000",
  "molecule":'AMPICILLINE',
  "quantity":"true",      
},
{
  "name":"BRUFEN 400 mg Ovule",
  "code":"947473838"
  "prix":"1300",
  "molecule":'AMPICILLINE',
  "quantity":"true",      
},
{
  "name":"GYNO - PVARYL  150 mg Ovule",
  "code":"007472838"
  "prix":"500",
  "molecule":'AMPICILLINE',
  "quantity":"true",      
},
{
  "name":"FORTALINE 93 g  Sirop",
  "code":"792093299"
  "prix":"1500",
  "molecule":'AMPICILLINE',
  "quantity":"true",      
},
{
  "name":"ACCUZON 250 mg Poudre",
  "code":"0483758"
  "prix":"1500",
  "molecule":'AMPICILLINE',
  "quantity":"true",      
}
]

I use application application/urlencoded to body content and then set application/json and authorization to header please how can I do to get array in backend nodejs

1

There are 1 answers

0
MOUTAIROU Bastou Abdel On

I've solve it by change the body content type by aplication/json and use this forma of array

{
   "id":"15",
   "products":[
     
     {
       "name":"AMPICILLINE TM 20 mg Gel",
       "code":"74647293",
       "price":"1000",
       "molecule":"AMPICILLINE",
       "quantity":"false"     
     },
     {
       "name":"BRUFEN 400 mg Ovule",
       "code":"947473838",
       "price":"1300",
       "molecule":"AMPICILLINE",
       "quantity":"fasle"      
     },
     {
       "name":"GYNO - PVARYL  150 mg Ovule",
       "code":"007472838",
       "price":"500",
       "molecule":"AMPICILLINE",
       "quantity":"true"      
     }
        
     ]
}