Problem
The unflatten method doesn't work with a key named toString.
For example, starting with this object:
{
"p5": {
"y": "The y component of the vector",
"toString": {
"returns": "String: "
}
}
}
Then flatten it:
{
'p5/y': 'The y component of the vector',
'p5/toString/returns': 'String: '
}
And then unflatten it:
{
"p5": {
"y": "The y component of the vector"
}
}
The toString key disappears.
Workaround
I ended up adding a prefix to all the keys while flattening the object (with the transformKey option), and then removing it after unflattening it again. To remove the prefix I used the map-obj library to map all the key and values from the original object to a new one, where the keys were substrings of the original ones.