You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Problem
The
unflatten
method doesn't work with a key namedtoString
.For example, starting with this object:
Then flatten it:
And then unflatten it:
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 themap-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.The text was updated successfully, but these errors were encountered: