Skip to content

eenchev/FlatJSONSearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

FlatJSONSearch

What is FlatJSONSearch:

Iterates over a directory of (several levels nested) JSONs. Checks if the key, passed as an argument exists.

Say we have file called hello.json with the following content:

{
   "glossary":{
      "title":"example glossary",
      "GlossDiv":{
         "title":"S",
         "GlossList":{
            "GlossEntry":{
               "ID":"SGML",
               "SortAs":"SGML",
               "GlossSee":"markup"
            }
         }
      }
   }
}

Executing the script with "SortAs" as key parameter:

evgeni@x:~$ python ./flat_json_search.py -k "SortAs"

will result in the following output:

Found in file hello.json:
Key: glossary_GlossDiv_GlossList_GlossEntry_SortAs, Value: SGML

Note how the nested key sequence is transformed to a snake_case variable name for the final key.

Additional features:

  • Filter by value, corresponding to the key, using the -v flag
  • Set directory path via the -d flag

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages