Flatten a nested object with an escaped property name
Example input
{"user":{"a/b":2}}Expected result
{
"/user/a~1b": 2
}Flatten the object. The slash inside the property name becomes ~1, while the slashes between path segments describe nesting. Unflattening this map restores the original property name and numeric value. A literal tilde is escaped as ~0, so paths must be decoded with the same mapping.