{"id":20789730,"url":"https://github.com/s4kibs4mi/kotlin-jsonq","last_synced_at":"2025-05-05T19:51:01.072Z","repository":{"id":73919203,"uuid":"133623354","full_name":"s4kibs4mi/kotlin-jsonq","owner":"s4kibs4mi","description":"A simple Kotlin library to Query over Json Data.","archived":false,"fork":false,"pushed_at":"2018-09-13T06:58:43.000Z","size":88,"stargazers_count":30,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T23:11:29.023Z","etag":null,"topics":["json","json-manager","json-query","kotlin-android","kotlin-library"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s4kibs4mi.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-16T06:53:33.000Z","updated_at":"2022-10-03T15:45:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f65d0f5-f988-410c-9230-065fccf47dd3","html_url":"https://github.com/s4kibs4mi/kotlin-jsonq","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s4kibs4mi%2Fkotlin-jsonq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s4kibs4mi%2Fkotlin-jsonq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s4kibs4mi%2Fkotlin-jsonq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s4kibs4mi%2Fkotlin-jsonq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s4kibs4mi","download_url":"https://codeload.github.com/s4kibs4mi/kotlin-jsonq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252565753,"owners_count":21768911,"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":["json","json-manager","json-query","kotlin-android","kotlin-library"],"created_at":"2024-11-17T15:26:38.328Z","updated_at":"2025-05-05T19:51:01.066Z","avatar_url":"https://github.com/s4kibs4mi.png","language":"Kotlin","funding_links":[],"categories":["Developer Tools \u0026 Libraries"],"sub_categories":["🚀 How to contribute"],"readme":"kotlin-jsonq\n===============\n[![](https://jitpack.io/v/ninja.sakib/kotlin-jsonq.svg)](https://jitpack.io/#ninja.sakib/kotlin-jsonq) [![License: CC0-1.0](https://img.shields.io/badge/License-CC0%201.0-lightgrey.svg)](https://github.com/s4kibs4mi/kotin-jsonq/blob/master/LICENSE)\n\nA simple Kotlin library to Query over JSON Data\n\n### Installation\n\nGradle,\n```gradle\nallprojects {\n    repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nAnd\n```gradle\ndependencies {\n    implementation 'ninja.sakib:kotlin-jsonq:v0.2'\n}\n```\n\n### Usage\nLet's see a quick example:\n\n\u003cdetails\u003e\u003csummary\u003eSample data (data.json)\u003c/summary\u003e\n```json\n{\n  \"name\": \"products\",\n  \"description\": \"Features product list\",\n  \"vendor\": {\n    \"name\": \"Computer Source BD\",\n    \"email\": \"info@example.com\",\n    \"website\": \"www.example.com\"\n  },\n  \"users\": [\n    {\n      \"id\": 1,\n      \"name\": \"Johura Akter Sumi\",\n      \"location\": \"Barisal\"\n    },\n    {\n      \"id\": 2,\n      \"name\": \"Mehedi Hasan Nahid\",\n      \"location\": \"Barisal\"\n    },\n    {\n      \"id\": 3,\n      \"name\": \"Ariful Islam\",\n      \"location\": \"Barishal\"\n    },\n    {\n      \"id\": 4,\n      \"name\": \"Suhel Ahmed\",\n      \"location\": \"Sylhet\"\n    },\n    {\n      \"id\": 5,\n      \"name\": \"Firoz Serniabat\",\n      \"location\": \"Gournodi\"\n    },\n    {\n      \"id\": 5,\n      \"name\": \"Musa Jewel\",\n      \"location\": \"Barishal\",\n      \"visits\": [\n        {\n          \"name\": \"Sylhet\",\n          \"year\": 2011\n        },\n        {\n          \"name\": \"Cox's Bazar\",\n          \"year\": 2012\n        },\n        {\n          \"name\": \"Bandarbar\",\n          \"year\": 2014\n        }\n      ]\n    }\n  ],\n  \"products\": [\n    {\n      \"id\": 1,\n      \"city\": \"bsl\",\n      \"name\": \"iPhone\",\n      \"cat\": 1,\n      \"price\": 80000.5\n    },\n    {\n      \"id\": 2,\n      \"city\": null,\n      \"name\": \"macbook pro\",\n      \"cat\": 2,\n      \"price\": 150000.1\n    },\n    {\n      \"id\": 3,\n      \"city\": \"dhk\",\n      \"name\": \"Redmi 3S Prime\",\n      \"cat\": 1,\n      \"price\": 12000.1\n    },\n    {\n      \"id\": 4,\n      \"city\": null,\n      \"name\": \"Redmi 4X\",\n      \"cat\": 1,\n      \"price\": 15000.1\n    },\n    {\n      \"id\": 5,\n      \"city\": \"bsl\",\n      \"name\": \"macbook air\",\n      \"cat\": 2,\n      \"price\": 110000.00\n    },\n    {\n      \"id\": 6,\n      \"city\": null,\n      \"name\": \"macbook air 1\",\n      \"cat\": 2,\n      \"price\": 81000.2\n    }\n  ],\n  \"cities\": [\n    {\n      \"id\": 1,\n      \"name\": \"Barishal\"\n    },\n    {\n      \"id\": 2,\n      \"name\": \"Noakhali\"\n    },\n    {\n      \"id\": 3,\n      \"name\": \"Dhaka\"\n    },\n    {\n      \"id\": 4,\n      \"name\": \"Rajshahi\"\n    },\n    {\n      \"id\": 5,\n      \"name\": \"Chittagong\"\n    }\n  ],\n  \"arr\": [\n    1,\n    2,\n    3,\n    4\n  ]\n}\n```\n\u003c/details\u003e\n\n### Examples\n\n- [x] Initialization,\n```kotlin\nval inputStream = Thread.currentThread().contextClassLoader.getResourceAsStream(\"data.json\")\njsonq = JSONQ(inputStream)\n```\n\n- [x] find,\n```kotlin\nval obj = jsonq.find(\"users.5.visits\")\n```\nResult,\n```json\n[\n  {\n    \"name\": \"Sylhet\",\n    \"year\": 2011\n  },\n  {\n    \"name\": \"Cox's Bazar\",\n    \"year\": 2012\n  },\n  {\n    \"name\": \"Bandarbar\",\n    \"year\": 2014\n  }\n]\n```\n\n- [x] whereEq,\n```kotlin\nval res = jsonq.from(\"users.5.visits\").whereEq(\"name\", \"Bandarbar\")\n```\nResult,\n```json\n[\n  {\n    \"name\": \"Bandarbar\",\n    \"year\": 2014\n  }\n]\n```\n\n- [x] hasSuffix,\n```kotlin\nval res = jsonq.from(\"users\").hasSuffix(\"name\", \"Sumi\")\n```\nResult,\n```json\n[\n  {\n    \"id\": 1,\n    \"name\": \"Johura Akter Sumi\",\n    \"location\": \"Barisal\"\n  }\n]\n```\n\n- [x] Query Chaining\n```kotlin\nval res = jsonq.from(\"users\").whereGe(\"id\", 3).whereEq(\"location\", \"Barisal\").contains(\"name\", \"Is\")\n```\nResult,\n```json\n[\n  {\n    \"id\": 3,\n    \"name\": \"Ariful Islam\",\n    \"location\": \"Barisal\"\n  }\n]\n```\n\n## TODO\n\n- [ ] Add missing methods\n- [ ] Write full documentation with example\n\n## Bugs and Issues\n\nIf you encounter any bugs or issues, feel free to [open an issue at\ngithub](https://github.com/s4kibs4mi/kotlin-jsonq/issues).\n\nAlso, you can shoot me an email to\n\u003cmailto:root@sakib.ninja\u003e for hugs or bugs.\n\n## Special Mention\n\n[Nahid Bin Azhar](https://github.com/nahid) for the original idea.\n\n## Contribution\nIf you are interested to make the package better please send pull requests or create an issue so that others can fix.\n[Read the contribution guide here](CONTRIBUTING.md)\n\n## See all [contributors](https://github.com/s4kibs4mi/kotlin-jsonq/graphs/contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs4kibs4mi%2Fkotlin-jsonq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs4kibs4mi%2Fkotlin-jsonq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs4kibs4mi%2Fkotlin-jsonq/lists"}