node package manager


load/convert between xml,json,yaml formats


collection of convertors. Comes with command line options to use the convertors along with a library version that can be used within programs as well.


  • read input formats json, xml, yaml
  • converts the document to internal javascript object form
  • write output as json, yaml documents
  • only input xml is handled (no output xml yet)
$ npm install -g to
$ npm install to

Command line:

 # reads xml file and prints it in yml
 $ to -i examples/sample.xml -o .yaml
 # reads yaml and prints it in json
 $ to -i examples/sample.yml -o .json

Within your program:

var to = require('to');

# Load yaml
var yamldoc = to.format.yaml.load('config.yaml');

# print doc in yaml 
var doc = ...;
  • refer to examples directory for xml, json, yaml code

For a sample input xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">    
<value>one more</value>

Output in json:

  "dummy": {
    "value": [
      "one more"
    "h": [
    "object": "value",
    "inner": {
      "h1": "value",
      "li": [

# to try this example
$ to -i examples/sample1.xml -o .json

Output in yaml:

    - 15
    - 35
    - 5
    - 4784
    - "one more"
    - decent
    - list
    - another
  object: value
    h1: value
      - got
      - milk

# to try this example
$ to -i examples/sample1.xml -o .yaml
  • Input html (be forgiving with bad html)
  • Input markdown
  • Output xml
  • Output html
  • add unit tests
  • allow beautification params for all outputs

To execute full test cases

$ make