Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy a path in a JSON in IntelliJ IDEA?

Is it possible to copy a path in a JSON file? For example in this file:

{
  "a": {
    "b": {
      "c": "keyC"
    }
  }
}

when I am on a "keyC" and I would press some hotkey, I'd get an a.b.c string in the clipboard.

like image 815
monnef Avatar asked Sep 14 '17 08:09

monnef


People also ask

How do I copy a path in IntelliJ?

Copy pathsPress Ctrl+Shift+C to copy the absolute path to the current file. Choose Edit | Copy Path/Reference from the main menu. In the popup that opens, choose what part of the path you want to copy — filename, absolute, or relative path.

How do I format JSON in IntelliJ?

Usage: Paste JSON string into editor, and press Reformat Code (Ctrl + Alt + L in windows) to format code as if you editing a file with . json suffix. The plugin panel will appear on the right side of the window after installed, and you don't have to restart the IDE.


1 Answers

I know this post is old, but I thought I'd give an updated answer.

I came across this question because I was looking for the same thing, then discovered the feature actually exists in WebStorm already (I'm assuming it exists in IntelliJ as well).

Basically, put your cursor on the node you want, and you'll see the path at the bottom of the editor window. Then you can right-click on the path and select "Copy qualified name to clipboard".

Here's an example of doing this from my IDE:

enter image description here

like image 107
jalbr74 Avatar answered Oct 05 '22 01:10

jalbr74