Thursday, 27 April 2017

nodeJS xml2js - Erro while saving XML converted JSON object back to XML

I am using xml2js module in NodeJs. I have successfully parse the XML through xml2js and received the JSON object for that XML. Then on runtime I have changed the values in JSON object. When I try to convert that JSON object to XML through xml2js.Builder() I am getting the below error. Can anyone please help me to understand the error and resolve the same.

SyntaxError: Unexpected token o in JSON at position 1 at Object.parse (native) at D:\user1\official\projects\prject1\tool\samples\file-uploader-m aster\file-uploader-master\app.js:101:40 at Layer.handle [as handle_request] (D:\user1\official\projects\prject1\Ed iting_Tool\samples\file-uploader-master\file-uploader-master\node_modules\expres s\lib\router\layer.js:95:5) at next (D:\user1\official\projects\prject1\tool\samples\file-uplo ader-master\file-uploader-master\node_modules\express\lib\router\route.js:137:13 ) at Route.dispatch (D:\user1\official\projects\prject1\tool\samples \file-uploader-master\file-uploader-master\node_modules\express\lib\router\route .js:112:3) at Layer.handle [as handle_request] (D:\user1\official\projects\prject1\Ed iting_Tool\samples\file-uploader-master\file-uploader-master\node_modules\expres s\lib\router\layer.js:95:5) at D:\user1\official\projects\prject1\tool\samples\file-uploader-m aster\file-uploader-master\node_modules\express\lib\router\index.js:281:22 at Function.process_params (D:\user1\official\projects\prject1\Editing_Too l\samples\file-uploader-master\file-uploader-master\node_modules\express\lib\rou ter\index.js:335:12) at next (D:\user1\official\projects\prject1\tool\samples\file-uplo ader-master\file-uploader-master\node_modules\express\lib\router\index.js:275:10 ) at jsonParser (D:\user1\official\projects\prject1\tool\samples\fil e-uploader-master\file-uploader-master\node_modules\body-parser\lib\types\json.j s:94:7)

Thanks in advance.

-kt



via KT B

No comments:

Post a Comment