-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring Objects to highest level in output #9
Comments
Am I right in saying that what you want is having, for every set of positions an object is referred to, to keep the one which is at the lowest depth ? If so this is an interesting request. |
Yeah. If by lowest you mean lowest index. Current Desired: |
The request is clear. The problem is that to do this I'd need to handle the object to stringify in two times : a BFS traversal to know where to keep and where to prune, followed by the DFS traversal which is the natural order of JSON writing. This is feasible but not totally trivial to minimize the impact on performance. |
As the changes envisioned here would take some time to code and wouldn't be without impact on the library size and efficiency, I'd like to have more feedback from users before diving into it. Please comment here or on Miaou. |
Could this be opt-in? |
For the performance, yes. But not reasonably for the library size. |
A complex structure can show the highest level item as 'pruned' forcing one to sift through the json atring to find the one unpruned source. Example: https://jsonblob.com/bf90de6d-caf5-11e7-8bfc-27c198b81400
In the example, the root level "server" is pruned and the original is somewhere in the json with a key NOT labeled "server" making it VERY difficult to find. It would be much better if the root level server had the object.
The text was updated successfully, but these errors were encountered: