1.0.4 • Published 6 years ago

jtx v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

jtx

Description

Tiny JSON to XML conversion utility.

Installation

npm install jtx

Usage

Javascript

import jtx from 'jtx'

const myJson = {
    "hello": {
        "there": [
            {
                "i": null,
                "am": 1,
                "here": undefined
            }
        ]
    }
}

console.log(jtx(myJson))

// <hello><there><0><i></i><am>1</am></0></there></hello>

Input

Accepts:

  • String

  • Object

  • Array

Output

XML String

Options

You can pass an optional configuration object as the last parameter:

const myJson = { test: true }
jtx(myJson, { header: true })
// <?xml version="1.0" encoding="UTF-8" standalone="no" ?><test>true</test>
Available Options
nametypedefault
headerbooleanfalse

CLI

Usage

Example One:

$ jtx test

test

Example Two:

test.json

{
    "hello": "there"
}
$ jtx test.json

<hello>there</hello>

Input

Accepts:

  • String

  • Filepath

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago