{"id":33993155,"url":"https://github.com/baacode/json-browser","last_synced_at":"2026-04-09T13:02:55.098Z","repository":{"id":62490905,"uuid":"110636537","full_name":"baacode/json-browser","owner":"baacode","description":"Helper library for browsing \u0026 editing JSON data","archived":false,"fork":false,"pushed_at":"2018-02-28T08:13:31.000Z","size":398,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-22T16:36:21.190Z","etag":null,"topics":["json"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baacode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-14T03:38:47.000Z","updated_at":"2018-08-09T04:21:57.000Z","dependencies_parsed_at":"2022-11-02T11:15:59.247Z","dependency_job_id":null,"html_url":"https://github.com/baacode/json-browser","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/baacode/json-browser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baacode%2Fjson-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baacode%2Fjson-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baacode%2Fjson-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baacode%2Fjson-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baacode","download_url":"https://codeload.github.com/baacode/json-browser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baacode%2Fjson-browser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27701850,"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","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["json"],"created_at":"2025-12-13T07:04:02.458Z","updated_at":"2025-12-13T07:04:04.517Z","avatar_url":"https://github.com/baacode.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"JSON Browser\n============\n\n[![Build Status](https://travis-ci.org/baacode/json-browser.svg?branch=master)](https://travis-ci.org/baacode/json-browser)\n[![Coverage Status](https://coveralls.io/repos/github/baacode/json-browser/badge.svg?branch=master)](https://coveralls.io/github/baacode/json-browser?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/baacode/json-browser/version)](https://packagist.org/packages/baacode/json-browser)\n[![License](https://poser.pugx.org/baacode/json-browser/license)](https://packagist.org/packages/baacode/json-browser)\n[![Maintainability](https://api.codeclimate.com/v1/badges/066738ab622644a2ab55/maintainability)](https://codeclimate.com/github/baacode/json-browser/maintainability)\n\nUsage\n-----\n\n```php\nuse JsonBrowser\\JsonBrowser;\n\n// returns a new JsonBrowser, or throws an exception if the JSON syntax is invalid\n$browser = new JsonBrowser();\n\n// load document as JSON string\n$browser-\u003eloadJSON($json);\n\n// attach to existing document\n$browser-\u003eattach($document);\n\n// check for child node\n$childExists = $browser-\u003echildExists('childName');\n\n// get child node\n$child = $browser-\u003egetChild('childName');\n$child = $browser-\u003echildName; // dynamic __get() alias\n\n// count child nodes\n$numChildren = count($browser);\n$numChildren = $browser-\u003ecount();\n\n// iterate through child nodes\nforeach ($browser as $childName =\u003e $childNode) {\n    // $childName is the index key of the child\n    // $childNode is another JsonBrowser object (equivalent to $browser-\u003egetChild($childName))\n}\n\n// check for sibling node\n$siblingExists = $child-\u003esiblingExists('siblingName');\n\n// get sibling node\n$child = $browser-\u003egetSibling('siblingName');\n\n// get arbitrary node by path\n$node = $browser-\u003egetNodeAt('#/childName/grandchildName/4');\n\n// get arbitrary node value by path\n$value = $browser-\u003egetValueAt('#/childName/grandchildName/4');\n\n// set arbitrary node value by path\n$browser-\u003esetValueAt('#/childName/grandchildName/4', 'myValue')\n\n// delete arbitrary node value by path\n$browser-\u003edeleteValueAt('#/childName/grandchildName/4')\n\n// get root node\n$root = $node-\u003egetRoot();\n\n// test whether a node is the root\n$nodeIsRoot = $node-\u003eisRoot();\n\n// get parent node\n$parent = $node-\u003egetParent();\n\n// get node value\n$value = $node-\u003egetValue();\n$value = $parent-\u003enode; // __get() alias method when OPT_GET_VALUE is set\n\n// set node value\n$node-\u003esetValue('myValue');\n$parent-\u003enode = 'myValue'; // __set() alias method\n\n// delete node value\n$node-\u003edeleteValue();\n\n// get node type\n$type = $node-\u003egetType();\n\n// check whether the node exists\n$nodeExists = $node-\u003enodeExists();\n\n// test whether the node is at least one of the given types\n$isType = $node-\u003eisType(JsonBrowser::TYPE_STRING | JsonBrowser::TYPE_NUMBER);\n\n// test whether the node is *not* any of the given types\n$isNotType = $node-\u003eisNotType(JsonBrowser::TYPE_NULL | JsonBrowser::TYPE_INTEGER);\n\n// test for equality\n$isEqual = $node-\u003eisEqualTo(\"myValue\");\n\n// get node path\n$path = $node-\u003egetPath();\n\n// get JSON source for node\n$json = $node-\u003egetJSON();\n\n// get a node as the root of a subtree\n$root = $node-\u003easRoot();\n\n// set named annotation on a node\n$node-\u003esetAnnotation('myAnnotation', 'myValue'); // append to existing values\n$node-\u003esetAnnotation('myOtherAnnotation', 'myOtherValue', true); // overwrite previous values\n\n// get latest value for a named annotation, or null if not set\n$annotation = $node-\u003egetAnnotation('myAnnotation');\n\n// get array of values for a named annotation, empty array if not set\n$annotations = $node-\u003egetAnnotations('myAnnotation');\n\n// get an associative array of all annotations on a node, empty array if none set\n$annotations = $node-\u003egetAnnotations();\n\n```\n\nConfiguration Options\n---------------------\n\n| Name                       | Description                                                        |\n|----------------------------|--------------------------------------------------------------------|\n| OPT_DEFAULT                | Use the default options set (no user-configurable options enabled) |\n| OPT_NONEXISTENT_EXCEPTIONS | Throw an exception when attempting to read a nonexistent value     |\n| OPT_GET_VALUE              | Get values, rather than node objects, when using `__get()`         |\n| OPT_DECODE                 | Decode the document passed to the constructor as a JSON string     |\n\nDocumentation\n-------------\n\nComprehensive API documentation is available [here](https://baacode.github.io/json-browser/).\n\nInstallation\n------------\n\nTo install via composer, use:\n\n```bash\n$ composer require baacode/json-browser\n```\n\nRequirements\n------------\n\n - PHP \u003e= 7.0\n - PHP's native JSON extension\n - PHP's native mbstring extension\n - seld/jsonlint \u003e= 1.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaacode%2Fjson-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaacode%2Fjson-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaacode%2Fjson-browser/lists"}