dot-object
dot-object copied to clipboard
dot.object fails converting numeric nested json object
Example:
const dot = require('dot-object')
const config = {
level1: {
key1: 'val1',
2222: {
key2: 'val2'
}
},
3333: {
key3: 'val3'
}
}
console.log('original:')
console.log(config)
console.log()
const dotConfig = dot.dot(config)
console.log('should be the same as original:')
console.log(dot.object(dotConfig))
Output shows:
original:
{
'3333': { key3: 'val3' },
level1: { '2222': { key2: 'val2' }, key1: 'val1' }
}
should be the same as original:
{
'3333': { key3: 'val3' },
level1: [ <2222 empty items>, { key2: 'val2' }, key1: 'val1' ]
}
Found the solution: https://stackoverflow.com/a/7794127