{"id":19005326,"url":"https://github.com/f3ath/rfc-6901-dart","last_synced_at":"2025-04-22T19:02:35.816Z","repository":{"id":43470290,"uuid":"329076721","full_name":"f3ath/rfc-6901-dart","owner":"f3ath","description":"JSON Pointer (RFC 6901) implementation in Dart","archived":false,"fork":false,"pushed_at":"2023-08-27T01:03:41.000Z","size":41,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-17T10:27:02.786Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","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/f3ath.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-01-12T18:29:21.000Z","updated_at":"2023-12-31T12:30:55.000Z","dependencies_parsed_at":"2024-11-08T18:31:55.001Z","dependency_job_id":"d4f0accb-1bbe-4389-b93d-a742a4729bce","html_url":"https://github.com/f3ath/rfc-6901-dart","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.3793103448275862,"last_synced_commit":"d49bd2448628a6bc7f7885fc4d6c890e31a4878b"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Frfc-6901-dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Frfc-6901-dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Frfc-6901-dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Frfc-6901-dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f3ath","download_url":"https://codeload.github.com/f3ath/rfc-6901-dart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250306609,"owners_count":21408925,"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":[],"created_at":"2024-11-08T18:27:08.339Z","updated_at":"2025-04-22T19:02:35.791Z","avatar_url":"https://github.com/f3ath.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [RFC 6901] JSON Pointer\nJSON Pointer ([RFC 6901]) implementation in Dart.\n\nFeatures:\n- Reads, writes, removes values\n- Fully implements the standard, including the `-` character\n- Can build the entire path, e.g. `/foo/bar/-/baz`\n- No external dependencies\n- 100% test coverage\n\n## Constructing pointers\nA JSON Pointer object can be parsed from a string expression. \nThe expression MUST be a valid non-empty JSON Pointer expression with \"/\" and \"~\" escaped.\n```dart\nfinal pointer = JsonPointer('/foo/0/bar'); // a valid non-empty pointer\nfinal alsoPointer = JsonPointer('/foo/-'); // a valid non-empty pointer with a special \"-\" reference\nfinal emptyPointer = JsonPointer(); // an empty pointer\n\nJsonPointer('oops'); // throws a FormatException: expression doesn't start with \"/\"\nJsonPointer('/foo/~'); // throws a FormatException: unescaped \"~\"\n```\n\nIt can also be built from individual reference tokens. In such case, it will escape the tokens automatically.\n```dart\nfinal pointer = JsonPointer.build(['foo', '0', 'bar/']); // Makes \"/foo/0/bar~1\"\nfinal longerPointer = JsonPointerSegment('-', pointer); // Makes \"/foo/0/bar~1/-\"\nfinal evenLongerPointer = JsonPointerSegment('wow', longerPointer); // Makes \"/foo/0/bar~1/-/wow\"\n```\n\n## Reading and writing values\nThe `read()` method returns the referenced value. The `write()` method returns a copy of the document with \nthe referenced value replaced by the new value.\n```dart\nimport 'dart:convert';\n\nimport 'package:rfc_6901/rfc_6901.dart';\n\nvoid main() {\n  const json = '{\"foo\": [{\"bar\": 42}]}';\n  final document = jsonDecode(json);\n  print('Original document: $document');\n\n  [\n    '/foo', // reads the array\n    '/foo/0', // reads the first element of the array\n    '/foo/0/bar', // reads 42\n  ].forEach((expression) {\n    final pointer = JsonPointer(expression);\n    print('Pointer \"$pointer\" reads ${pointer.read(document)}');\n  });\n\n  [\n    '/foo/0/bar', // {foo: [{bar: banana}]}\n    '/foo/-', // {foo: [{bar: 42}, banana]}\n    '/a/b/-/c/d', // {foo: [{bar: 42}], a: {b: [{c: {d: banana}}]}}\n  ].forEach((expression) {\n    final pointer = JsonPointer(expression);\n    final d = pointer.write(document, 'banana');\n    print('Add a banana at \"$pointer\": $d');\n  });\n}\n```\n\n[RFC 6901]: https://tools.ietf.org/html/rfc6901\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff3ath%2Frfc-6901-dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff3ath%2Frfc-6901-dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff3ath%2Frfc-6901-dart/lists"}