- Convert text array to JSON
- Convert JSON to text array
npm install ary2json
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'
}
}
}
]
const ko = {
path1: {
path2: {
path3: '로그인'
}
}
}
objToTextPathsAry(ko).forEach(function (s) {
console.log(s)
})
로그인; path1; path2; path3
MIT © Bob Hwang