{"id":15017040,"url":"https://github.com/rooyca/query-json","last_synced_at":"2025-04-12T10:43:13.335Z","repository":{"id":239853755,"uuid":"800568422","full_name":"Rooyca/query-json","owner":"Rooyca","description":"Read, query and work with JSON inside Obsidian.","archived":false,"fork":false,"pushed_at":"2025-02-14T19:40:14.000Z","size":3581,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T05:41:45.242Z","etag":null,"topics":["json","obsidian","obsidian-md","obsidian-plugin","plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Rooyca.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":"2024-05-14T15:26:01.000Z","updated_at":"2025-02-23T21:52:15.000Z","dependencies_parsed_at":"2024-05-28T02:32:37.439Z","dependency_job_id":"8ebf819d-3a0e-4d35-9f66-ba2f6a4a5b64","html_url":"https://github.com/Rooyca/query-json","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.07407407407407407,"last_synced_commit":"d8ecba1401e78cf16cd1b49acfdd1b979f6f00d2"},"previous_names":["rooyca/query-json"],"tags_count":14,"template":false,"template_full_name":"obsidianmd/obsidian-sample-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rooyca%2Fquery-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rooyca%2Fquery-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rooyca%2Fquery-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rooyca%2Fquery-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rooyca","download_url":"https://codeload.github.com/Rooyca/query-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557673,"owners_count":21124161,"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","obsidian","obsidian-md","obsidian-plugin","plugin"],"created_at":"2024-09-24T19:49:43.469Z","updated_at":"2025-04-12T10:43:13.306Z","avatar_url":"https://github.com/Rooyca.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Q-JSON\n\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/rooyca/query-json?logo=github\u0026color=ee8449\u0026style=flat-square)](https://github.com/rooyca/query-json/releases/latest)\n[![Obsidian plugin release](https://img.shields.io/badge/Obsidian%20plugin%20release-purple?logo=obsidian\u0026style=flat-square)](https://obsidian.md/plugins?id=query-json)\n\n![qj-showcase](qj-showcase.gif)\n\nQuery JSON is a Obsidian plugin designed to simplify the process of querying and extracting data from JSON objects. By incorporating a user-friendly syntax, the plugin enables you to retrieve specific information from JSON data stored within your notes or external files.\n\n## ⚡ How to Use\n\nTo utilize QJSON, simply include the plugin's syntax within your note, encapsulating the JSON data or providing a file reference. Below is an example of the syntax:\n\n~~~markdown\n```qjson\n#qj-id: 23\n#qj-file: data.json\n#qj-hide-id\n#qj-show-json\n```\n~~~\n\n\u003e [!CAUTION]\n\u003e If your JSON files is considerably large it may slow down the rendering process. In those cases is better to [query the file directly.](#query-files-directly)\n\nThen, you can query the data using the following syntax:\n\n```\n@23\u003estore.books.0.author;\n```\n\n### Querying Data\n\nCrafting queries with QJSON is straightforward, allowing you to refine and extract specific information tailored to your needs. For instance, consider the following JSON:\n\n```json\n{\n  \"store\": {\n    \"books\": [\n      {\n        \"author\": \"John Doe\",\n        \"title\": \"The Book\"\n      }\n    ]\n  }\n}\n```\n\nTo retrieve the author of the first book within the store, use the following query:\n\n```\n@23\u003estore.books.0.author;\n```\n\n- `23`: represents the object identifier (ID)\n- `store.books.0.author`: specifies the path to the desired data\n\n#### Query files directly\n\nFurthermore, QJSON extends its functionality to external JSON files. For example, if you possess a file named `data.json` containing the same JSON data as above, you can use the following query:\n\n```\n@data.json\u003estore.books.0.author;\n```\n\nIt's also posible to query the file directly using the `#qj-query` flag:\n\n~~~markdown\n```qjson\n#qj-id: 24\n#qj-file: data.json\n#qj-show-json\n#qj-hide-id\n#qj-query: pageProps.heroData[win_rate \u003e= 55 \u0026\u0026 role == Mage]\n```\n~~~\n\nIf you want to get all the elements of an array you can use the `*` wildcard:\n\n~~~markdown\n```qjson\n#qj-id: 24\n#qj-file: data.json\n#qj-show-json\n#qj-hide-id\n#qj-query: pageProps.heroData[*]\n```\n~~~\n\n## 🏳️ Flags\n\nQuery JSON supports various flags to enhance customization and functionality:\n\n#### `#qj-id` INT (required)\n\nThis flag denotes the JSON object identifier. It must be unique and numeric.\n\n#### `#qj-hide-id` (optional)\n\nThis flag suppresses the display of the identifier after rendering.\n\n#### `#qj-desc` (optional)\n\nShort for \"id description,\" this flag provides a way to describe the JSON object. It is particularly useful for identifying the purpose of the object. The default value is `»»» QJSON «««`.\n\n#### `#qj-show-json` (optional)\n\nThis flag allows you to display the JSON within the rendered output. By default is hidden.\n\n#### `#qj-file` (optional)\n\nIf provided, this flag specifies the file path containing the JSON data. In its absence, the plugin scans for JSON data within the code block.\n\n#### `#qj-query` (optional)\n\nThis flag allows you to query the JSON file directly from your codeblock. The query syntax must be inside brackets `[]`. The supported operators are:\n\n- Logical operators: `\u0026\u0026`, `||`\n- Comparison operators: `==`, `!=`, `\u003e`, `\u003e=`, `\u003c`, `\u003c=`\n\n**Example**:\n\n~~~markdown\n```qjson\n#qj-id: 24\n#qj-file: data.json\n#qj-show-json\n#qj-hide-id\n#qj-query: pageProps.heroData[win_rate \u003e= 55 \u0026\u0026 role == Mage]\n```\n~~~\n\n\u003e [!NOTE]\n\u003e The `#qj-show-json` flag is mandatory when using the `#qj-query` flag.\n\n### `#qj-format` (optional)\n\nThis flag allows you to format the output of the JSON data. The supported values are:\n\n- `list`: displays the data in a list format\n- `table`: displays the data in a table format (see below)\n- `img`: displays the data as an image\n\n#### Improved **Table** Data Display (Thanks to [@ozppupbg](https://github.com/ozppupbg))\n\nAdd column formatting:\n\n`#qj-format: table[\u003cflags\u003e:\u003cfield or template\u003e:\u003clink field\u003e=\u003ccustom name\u003e,\u003cflags\u003e:\u003cfield or template\u003e:\u003clink field\u003e=\u003ccustom name\u003e,...]`\n\nFor example:\n\n`#qj-format: table[h:title=Name,:value,b:test=Value 2]`\n\nWith a template:\n\n`#qj-format: table[:\"Custom {value} of {test}\"=Something]`\n\nThe following flags are implemented:\n\n- **b**: display bold\n- **h**: header column/field (only allowed in the first entry)\n- **l**: create a link - a second field name must be provided, which contains the link URL\n- **c**: if a list of values is the content, use comma separation for the entries\n- **n**: if a list of values is the content, use new-line/separation for the entries\n\n## 🛠️ Contribution\n\nIf you encounter any issues or have suggestions for improvement, please feel free to contribute to the project. Your feedback is invaluable in enhancing the plugin's functionality and user experience.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frooyca%2Fquery-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frooyca%2Fquery-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frooyca%2Fquery-json/lists"}