Convert xml to json in Ionic2 framework (Typescript)

I am developing a mobile app using Ionic2 framework. I need to convert a xml file to json format.

For this I have installed “xml2json” using command “npm install xml2json --save”.

This has saved a module named “xml2json” in “node_modules” folder.

I can also see it under dependencies in “package.json” file as “xml2json”: “^0.9.1”

Now when I declared it in the .ts file as “import * as xml2json from “xml2json”;”, I am receiving the following error: “can not find module xml2json”

I guess I need to install the typings for this module. I have tried all the possible typings commands but could not install it. I received errors like

typings ERR! caused by responded with 404, expected it to equal 200

Please let me know how can I install typings for xml2json OR how can I use xml2json in my project. Thanks.

(NOTE: I have also tried above steps with x2js but the same issue. could not install typings for it too)

My system information:

typings version - 1.3.2

Cordova CLI: 6.3.0 Gulp version: CLI version 3.9.1 Gulp local: Local version 3.9.1 Ionic Framework Version: 2.0.0-beta.11 Ionic CLI Version: 2.0.0-beta.36 Ionic App Lib Version: 2.0.0-beta.19 OS: Distributor ID: Ubuntu Description: Ubuntu 16.04 LTS Node Version: v6.3.0

Kind of the same question asked previously on this forum.

I think this topic might help you in this.
convert XML input file to json

Kindly have a look through all responses.