How to request the data from rawbody as shown as JSON objects.
This is the my JSON values in rawbody See this Picture if you can't understand
{
"startdate" : "2017-05-28T09:00:00+05:30",
"endddate" : "2017-05-28T09:30:00+05:30",
"event" : "Meeting",
"type" :
[
"pickup" , "drop"
],
"details" :
{
"name" : "Zhunki",
"address" : "madras",
"from" : "vergeenia",
"to" : "malpur"
}
}
Now I want to get event, drop from type array, name and address from details objects.
My Express js Code is:
app.post('/trip' , function(req , res){
var event = req.rawBody.event;
var type = req.rawBody.type;
var name = req.rawBody.name;
var address = req.rawBody.address;
var jsonresult = {
status : 'ok',
message : event + 'Created Successfully'
};
res.json([json]);
})
Please help me... Thanks
via Ram Android
No comments:
Post a Comment