Skip to content

Instantly share code, notes, and snippets.

@alexs77
Last active January 23, 2022 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexs77/339a238a510adcfb23fbf0dc0672703b to your computer and use it in GitHub Desktop.
Save alexs77/339a238a510adcfb23fbf0dc0672703b to your computer and use it in GitHub Desktop.
Test JSON
{ "encrypted": false, "folders": [ { "id": "XXXXXXX", "name": "XXXXXXX" }, { "id": "XXXXXXX", "name": "XXXXXXX" }, { "id": "XXXXXXX", "name": "XXXXXXX" }, { "id": "XXXXXXX", "name": "XXXXXXX" }, { "id": "XXXXXXX", "name": "XXXXXXX" } ], "items": [ { "id": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXX", "organizationId": null, "folderId": null, "type": 1, "name": "XXXXXXX", "notes": null, "favorite": false, "login": { "uris": [ { "match": null, "uri": "XXXXXXX" } ], "username": "XXX@XXXX.XXX", "password": "XXXXXXX", "totp": null }, "collectionIds": null }, { "id": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXX", "organizationId": null, "folderId": null, "type": 1, "name": "XXXXXXX", "notes": null, "favorite": false, "login": { "uris": [ { "match": null, "uri": "XXXXXXX" } ], "username": "XXX@XXXX.XXX", "password": "XXXXXXX", "totp": null }, "collectionIds": null } ] }
#!/usr/bin/python3
import json, sys
def main():
data = json.load(sys.stdin)
for ci in data['items']:
try:
for uri in ci['login']['uris']:
try:
uri = uri['uri']
print(f"uri → {uri}")
except:
print("uri not found")
except:
print("uris not found")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment