Path parts are concatenated with . or wrapped with [""] for object keys and wrapped in [] for array indices.
Example:
For state like this (cursor position is bold)
{"a": ["q", {"k": 1}, 1]}
Path would be a[1].k.
For JS like this
var a = {"b": {c: 4, daq: [5, 15]}}
var b = {q: [2, 1**2**]}
Path would be q[1].
NOTE: JS objects are not validated.
Using
Launch command Copy Json Path from command palette or context menu.
Configuration
extension.copyJsonPath.nonQuotedKeyRegex: regex that tests whether key in path can be used without quotes. If key matches - key is not quoted. Use it if you want to have path a.b-c instead of a[\"b-c\"] for example. Default is ^[a-zA-Z$_][a-zA-Z\\d$_]*$.