Issue in accessing converted JSON object(XML to JSON) in Node

Not applicable

Hi,

Could you please someone help to address this issue. Currently, I am facing issue in reading json object data if request posted as XML and convert via XML-to-JSON policy.The same scripts are working fine for direct json payload. I don't see any difference in request content for converted object and direct json post.

Already using bodyparser in script,

var express = require('express');

var bodyParser = require('body-parser');

var http_server = express();

http_server.use(bodyParser.json())

Thanks,

Praveen.

0 2 152
2 REPLIES 2

@Praveen Kumar Elumalai . Is it possible for you to attach sample proxy to reproduce above issue ? Are you trying to read converted (using XML2Json policy) object in Node.JS ?

Former Community Member
Not applicable

Are you setting the content-type to application/json after you change the content to XML? Most likely, the body-parser npm module will require the content-type to be set for it to interpret the data as JSON.