Sample Header Ad - 728x90

How to get javascript key path in long json files in Linux

2 votes
1 answer
912 views
I'm using several keys from a long javascript object, represented as json. Example: ... "stock": { "type": 'str', "properties": { "warehouse": { "type": 123 }, "retail": { "type": false } } } ... I would like to know the full path of, for instance, the key type. Something like get-paht type obtaining root.somethingElse.stock.properties.retail.type without having to do it manually. This is a long file, and searching up and down doesn't seem productive... Cli or Gui tools tools are fine. However I can't find any application, extension or command-line tool that returns that. I tried "JsonView" for Chrome but I couldn't make it load a local file. jq Also doesn't seem to solve this, since there are some missing double quotes. **EDIT:** I realized this was a js object, although represented as json.
Asked by Fernando César (273 rep)
Feb 3, 2017, 10:02 AM
Last activity: Oct 23, 2024, 12:12 PM