ary2json

Convert text array to JSON

Usage no npm install needed!

<script type="module">
  import ary2json from 'https://cdn.skypack.dev/ary2json';
</script>

README

MIT Licence

ary2json

  • Convert text array to JSON
  • Convert JSON to text array

Install

npm install ary2json

Usage (text array to JSON)

const { textPathsAryToObj, objToTextPathsAry, toJSONString } = require('ary2json')
const obj = textPathsAryToObj([[ '로그인', 'login', 'path1', 'path2', 'path3' ]], {
  numberOfLanguageColumn: 2
})
console.log(toJSONString(obj))
[
  {
    path1: {
      path2: {
        path3: '로그인'
      }
    }
  },
  {
    path1: {
      path2: {
        path3: 'login'
      }
    }
  }
]

Usage (JSON to text array)

const ko = {
    path1: {
      path2: {
        path3: '로그인'
      }
    }
  }

objToTextPathsAry(ko).forEach(function (s) {
  console.log(s)
})
로그인; path1; path2; path3

License

MIT © Bob Hwang