Show path in JSON Viewer
Categories
(DevTools :: JSON Viewer, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: nickdev44, Assigned: xpresskaran98, Mentored)
Details
Attachments
(4 files, 1 obsolete file)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0
Steps to reproduce:
Find it useful to get the path to what ever node in the JSON tree one are after. In that regard I have a script that I run in console to show this. It adds a new toolbar in the view. In addition one can edit the path to navigate the tree.
- Open a JSON file in browser.
- Open DevTools (console) and execute attached script.
This is, of course, only meant as a proof of concept ~ not production code ;)
Actual results:
Adds a new toolbar with the path to selected node in the JSON tree. If one click on a node the path gets updated. One can also edit the path in the toolbar upon which the nodes get selected.
Uses two types of notation:
- Dot notation: .foo.bar[3].baz
- Slash notation: /foo/bar/3/baz
One can toggle between the two by changing the first character in path. Change it to . (dot) to use dot notation or / (forward slash) to use slash notation.
Added a "Copy Node" functionality in addition to the "Copy Path". Copy the data of a sub-section of the JSON. Should perhaps be a "pretty" copy option.
Comment 2•2 years ago
•
|
||
Very nice! This relates to bug 1833327
Updated•2 years ago
|
Comment 3•2 years ago
|
||
LyScott123 , is that something you'd like to give a try?
Comment 4•2 years ago
|
||
Yes, I would love to!!! Any additional information would be helpful! I also had a couple of questions about mercurial, which channel on Element would best to ask it? Thanks!!
Comment 5•2 years ago
|
||
Comment 6•2 years ago
|
||
(In reply to LyScott123 from comment #4)
Yes, I would love to!!!
Great, I'll assign you the bug
Any additional information would be helpful!
So the idea is to add a breadcrumb at the top of the JSON content, under the toolbar we already have (the one with Save, Copy, …)
So you'd add another element in https://searchfox.org/mozilla-central/rev/6602bdf9fff5020fbc8e248c963ddddf09a77b1b/devtools/client/jsonview/components/JsonPanel.js#143-157 , below JsonToolbar
return div(
{ className: "jsonPanelBox tab-panel-inner" },
JsonToolbar({
actions: this.props.actions,
dataSize: this.props.dataSize,
}),
div(
{
className: "panelContent",
id: "json-scrolling-panel",
tabIndex: 0,
},
content
)
);
This would get updated when the user selects a given node in the JSON tree.
We will need the tree component to let us know when a node was selected (https://searchfox.org/mozilla-central/rev/6602bdf9fff5020fbc8e248c963ddddf09a77b1b/devtools/client/shared/components/tree/TreeView.js#523), maybe adding a onRowSelected prop that we could pass from JsonPanel.js, that would then be handled by the JsonBreadcrumb you'll add
In the end, It could look like what VSCode is doing for JSON file (see Comment 5)
Let me know if you have any other questions :)
I also had a couple of questions about mercurial, which channel on Element would best to ask it? Thanks!!
You can ask in https://chat.mozilla.org/#/room/#developers:mozilla.org , if it's more specific people will redirect you to other channel
Comment 7•1 year ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Comment 8•1 year ago
|
||
Hey! Happy to take this feature request
(unfortunately, I've lost access to my previous account :nlopin)
| Assignee | ||
Comment 9•1 year ago
|
||
Hello, it seems no one is currently working on this issue. Could you please assign the bug to me?
Comment 10•1 year ago
|
||
(In reply to Karan Yadav from comment #9)
Hello, it seems no one is currently working on this issue. Could you please assign the bug to me?
sure, thanks for offering help Karan :)
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 11•1 year ago
|
||
| Assignee | ||
Comment 12•3 months ago
|
||
Description
•