{"id":22295921,"url":"https://github.com/mkalioby/jsonlookup","last_synced_at":"2025-06-20T04:06:26.262Z","repository":{"id":62572878,"uuid":"58079862","full_name":"mkalioby/jsonLookup","owner":"mkalioby","description":"Searching in MySQL JSON field in Django","archived":false,"fork":false,"pushed_at":"2020-10-27T11:21:53.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-20T04:05:41.907Z","etag":null,"topics":["django","json","json-fields","mysql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkalioby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-04T19:50:36.000Z","updated_at":"2020-10-27T11:21:55.000Z","dependencies_parsed_at":"2022-11-04T00:19:32.850Z","dependency_job_id":null,"html_url":"https://github.com/mkalioby/jsonLookup","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mkalioby/jsonLookup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalioby%2FjsonLookup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalioby%2FjsonLookup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalioby%2FjsonLookup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalioby%2FjsonLookup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkalioby","download_url":"https://codeload.github.com/mkalioby/jsonLookup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalioby%2FjsonLookup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260878331,"owners_count":23075959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","json","json-fields","mysql"],"created_at":"2024-12-03T17:43:35.023Z","updated_at":"2025-06-20T04:06:21.238Z","avatar_url":"https://github.com/mkalioby.png","language":"Python","readme":"# jsonLookup\nSearching in MySQL JSON field in Django\n\n# Challenge\n\nMySQL has introduced JSON fields in MySQL Server 5.7, Currently it works well with [jsonfield](https://github.com/bradjasper/django-jsonfield) for Data Saving and retrieval. The problem that Searching can only be done through LIKE operator which isn't convinent for all function.\n\n# Objective\n\nCreating a new custom lookup operator \"has\" for Django that will support JSON Search in MySQL.\n\n# Installation\n\n### Install the Package\n```sh\n$ pip install jsonLookup\n```\n\n### Register to JSONFields\n\n```python\nfrom jsonLookup import hasLookup,jcontainsLookup\nJSONField.register_lookup(hasLookup)\nJSONField.register_lookup(jcontainsLookup)\n```\n\n### Write your JSON queries\n\n```python\n# Create test objects\nUser.objects.create(name=\"Ahmed\",properties={\"city\":\"Giza\",\"Address\":{\"district\":\"Ahram\",\"Code\":11263}})\nUser.objects.create(name=\"Mohamed\",properties={\"city\":\"Cairo\",\"Address\":{\"district\":\"Helipolis\",\"Code\":11351}})\n# Run first query\nq = User.objects.filter(properties__has=\"$.city=Giza\")\nprint q[0].name\n\"Ahmed\"\n# Run Second query\nq= User.objects.filter(properties__has=\"$.Address.Code=11351\")\nprint q[0].name\n\"Mohamed\"\n```\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkalioby%2Fjsonlookup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkalioby%2Fjsonlookup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkalioby%2Fjsonlookup/lists"}