{"id":33933480,"url":"https://github.com/backprog/hson","last_synced_at":"2026-04-01T20:44:45.245Z","repository":{"id":57634433,"uuid":"163078139","full_name":"backprog/hson","owner":"backprog","description":"JSON like format, which represent a HTML structure in a JSON style","archived":false,"fork":false,"pushed_at":"2019-03-05T08:28:08.000Z","size":78,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-14T21:06:52.492Z","etag":null,"topics":["html","json","rust","wasm"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/backprog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-25T11:48:48.000Z","updated_at":"2020-05-12T22:21:08.000Z","dependencies_parsed_at":"2022-09-16T04:01:43.579Z","dependency_job_id":null,"html_url":"https://github.com/backprog/hson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/backprog/hson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backprog%2Fhson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backprog%2Fhson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backprog%2Fhson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backprog%2Fhson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/backprog","download_url":"https://codeload.github.com/backprog/hson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backprog%2Fhson/sbom","scorecard":{"id":222656,"data":{"date":"2025-08-11","repo":{"name":"github.com/backprog/hson","commit":"e59883f61f7d0b636cdd14ac5c760cc02fe13fc8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T02:57:27.385Z","repository_id":57634433,"created_at":"2025-08-17T02:57:27.386Z","updated_at":"2025-08-17T02:57:27.386Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["html","json","rust","wasm"],"created_at":"2025-12-12T13:04:16.198Z","updated_at":"2026-04-01T20:44:45.232Z","avatar_url":"https://github.com/backprog.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hson\nJSON like format for HTML.  \nThe parser can be used for other purposes, but its main goal is to represent a HTML structure in a JSON style.  \nAllow to query the data the same way the DOM is queried client-side through `QuerySelectorAll` method. \n\n## Main differences with standard json\n* Allow same key multiple times in same object\n\n## Usage\n   [Parsing](#Parsing)  \n   [Stringifying](#Stringifying)   \n   [Searching](#Searching)  \n   [Inserting](#Inserting)  \n   [Removing](#Removing)  \n   [Iterating](#Iterating)  \n   [Debugging](#Debugging)  \n   [Events listening](#Events)  \n   [Nodes manipulation](#Manipulation)\n   \n### Parsing\n```rust\nuse hson::{ Hson, Debug };\n  \n...\n  \nlet data = r#\"{\n                \"div\": {\n                  \"attrs\": {\n                    \"class\": [\"\"],\n                    \"onClick\": \"doSomething\"\n                  },\n                  \"div\": {\n                    \"p\": {\n                      \"attrs\": {},\n                      \"span\": {\n                        \"text\": \"Hello\"\n                      }\n                    },\n                    \"p\": {}\n                  },\n                  \"div\": {\n                    \"component\": \"test\",\n                    \"attrs\": {},\n                    \"onClick\": \"componentDoSomething\"\n                  }\n                }\n              }\"#;\n              \nlet mut hson = Hson::new();\nhson.parse(\u0026data).unwrap();\nhson.print_data(true);\n```\n\n### Stringifying\n```rust\n...\n  \nlet s = hson.stringify();\nprintln!(\"{}\", \u0026s);\n```\n\n### Searching\nSearch is similar to the javascript `querySelectorAll` method.  \n```rust\nuse hson::{ Hson, Query, Search };\n  \n...\n  \n// Standard recursive search\nlet results = hson.search(\"div p\").unwrap();\nprintln!(\"\\n{:?}\\n\", results);\n  \n// Look for immediate childs, no recursive search\nlet results = hson.search(\"div\u003ep\").unwrap();\nprintln!(\"\\n{:?}\\n\", results);\n  \n// Look for multiple childs (OR search)\nlet results = hson.search(\"attrs id|rate|trusted\").unwrap();\nprintln!(\"\\n{:?}\\n\", results);\n  \n// Look for a node with a specific value\nlet results = hson.search(\"attrs id='12'\").unwrap();\nprintln!(\"\\n{:?}\\n\", results);\n  \n// All those features can be combined\nlet results = hson.search(\"div\u003ep attrs id='12'|rate='3'|trusted\").unwrap();\nprintln!(\"\\n{:?}\\n\", results);\n  \n// Look for childs in a specific node, no recursion\nlet results = hson.search_in(node_id, \"div\u003ep\").unwrap();\nprintln!(\"\\n{:?}\\n\", results);\n  \nlet results = hson.search_in(node_id, \"\u003ep\").unwrap();\nprintln!(\"\\n{:?}\\n\", results);\n```\n\n### Inserting\n```rust\nuse hson::{ Hson, Query, Ops, Debug };\n  \n...\n  \nlet results = hson.query(\"div p\").unwrap();\nlet child = r#\"{\n                    \"i\": {\n                        \"class\": [],\n                        \"text\": \"World\"\n                    },\n                    \"ul\": {\n                        \"class\": [\"active\",\"test\"]\n                    }\n                }\"#;\n  \nhson.insert(results[0], 1, child).unwrap();\nhson.print_data(true);\n```\n\n### Removing\n```rust\nuse hson::{ Hson, Query, Ops, Debug };\n  \n...\n  \nlet results = hson.query(\"p\").unwrap();\n\nhson.remove(results[0]).unwrap();\nhson.print_data(true);\n```\n\n### Iterating\nIterate over the nodes identifiers\n```rust\n...\n  \nfor id in hson {\n    println!(\"{}\", id);\n}\n  \n// OR\nloop {\n    let id = match hson.next() {\n        Some(s) =\u003e s,\n        None =\u003e break\n    };\n  \n    match \u0026hson.nodes.get(\u0026id) {\n        Some(node) =\u003e {\n            println ! (\"{} : {}\", node.instance, node.id);\n        }\n        None =\u003e {\n            break\n        }\n    }\n}\n```\n\n### Debugging\n```rust\nuse hson::{ Hson, Debug };\n  \n...\n  \nhson.print_process_time();\nhson.print_nodes(true); // true for sorted printing\nhson.print_data(true); // true for pretty printing\n```\n\n### Events\nCurrent supported events are _Parse_, _Insert_, _Remove_.\n```rust\nuse hson::{ Hson, Ops, Event };\n  \n...\n  \nfn on_event (evt: Event, uid: u64) {\n    println!(\"\\nEVENT : {:?} on {}\\n\", evt, uid);\n}\n  \nlet mut hson = Hson::new();\nhson.subscribe(on_event);\n  \n...\n```\n\n### Manipulation\nNodes values can be casted to primitive types using `Vertex`, a `Node` clone with more attributes.  \n_**Note : Vertex are Nodes clones and not references to the underlying Nodes. Manipulating Vertex's values will not be reflected on their matching Nodes.**_\n```rust\nuse hson::{ Hson, Query, Search, Cast };\n  \n...\n  \nlet results = hson.search(\"div attrs class\").unwrap();\nlet vertex = hson.get_vertex(results[0]).unwrap();\n  \n// Get vertex value as u64\nprintln!(\"{}\", vertex.value_as_f64());\n  \n// Get vertex value as a vector of String\nprintln!(\"{:?}\", vertex.value_as_array());\n  \n// Cast a string value to a different type\nlet s = \"0.456\";\nprintln!(\"{}\", vertex.as_f64(s));\n```\n\n##### Vertex methods\n* `fn key_as_string (\u0026self) -\u003e Option\u003cString\u003e`\n* `fn key_as_f64 (\u0026self) -\u003e Option\u003cf64\u003e`\n* `fn key_as_i64 (\u0026self) -\u003e Option\u003ci64\u003e`\n* `fn key_as_u64 (\u0026self) -\u003e Option\u003cu64\u003e`\n* `fn key_as_bool (\u0026self) -\u003e Option\u003cbool\u003e`\n* `fn value_as_string (\u0026self) -\u003e Option\u003cString\u003e`\n* `fn value_as_f64 (\u0026self) -\u003e Option\u003cf64\u003e`\n* `fn value_as_i64 (\u0026self) -\u003e Option\u003ci64\u003e`\n* `fn value_as_u64 (\u0026self) -\u003e Option\u003cu64\u003e`\n* `fn value_as_bool (\u0026self) -\u003e Option\u003cbool\u003e`\n* `fn value_as_array (\u0026self) -\u003e Option\u003cVec\u003cString\u003e\u003e`\n* `fn as_f64 (\u0026self, value: \u0026str) -\u003e Option\u003cf64\u003e`\n* `fn as_i64 (\u0026self, value: \u0026str) -\u003e Option\u003ci64\u003e`\n* `fn as_u64 (\u0026self, value: \u0026str) -\u003e Option\u003cu64\u003e`\n* `fn as_bool (\u0026self, value: \u0026str) -\u003e Option\u003cbool\u003e`\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackprog%2Fhson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbackprog%2Fhson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackprog%2Fhson/lists"}