{"id":13509250,"url":"https://github.com/joshrieken/test_that_json","last_synced_at":"2026-02-19T20:31:27.505Z","repository":{"id":62430408,"uuid":"62848159","full_name":"joshrieken/test_that_json","owner":"joshrieken","description":"JSON-related helpers for your Elixir testing needs","archived":false,"fork":false,"pushed_at":"2018-05-17T16:20:47.000Z","size":87,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T07:34:11.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/joshrieken.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-08T01:04:55.000Z","updated_at":"2021-07-11T17:31:33.000Z","dependencies_parsed_at":"2022-11-01T20:22:37.228Z","dependency_job_id":null,"html_url":"https://github.com/joshrieken/test_that_json","commit_stats":null,"previous_names":["facto/test_that_json"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/joshrieken/test_that_json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrieken%2Ftest_that_json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrieken%2Ftest_that_json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrieken%2Ftest_that_json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrieken%2Ftest_that_json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshrieken","download_url":"https://codeload.github.com/joshrieken/test_that_json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshrieken%2Ftest_that_json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29630829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T18:02:07.722Z","status":"ssl_error","status_checked_at":"2026-02-19T18:01:46.144Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2024-08-01T02:01:05.219Z","updated_at":"2026-02-19T20:31:27.490Z","avatar_url":"https://github.com/joshrieken.png","language":"Elixir","funding_links":[],"categories":["Testing"],"sub_categories":[],"readme":"# Test That JSON!\n\nHelpers for a better JSON testing experience in Elixir.\n\n[![Build Status](https://travis-ci.org/facto/test_that_json.svg?branch=master)](https://travis-ci.org/facto/test_that_json)\n[![Inline docs](http://inch-ci.org/github/facto/test_that_json.svg)](http://inch-ci.org/github/facto/test_that_json)\n\nUsing [ESpec](https://github.com/antonmi/espec)? Check out [test_that_json_espec](https://github.com/facto/test_that_json_espec).\n\n\n## Docs\n\n[All Docs](https://hexdocs.pm/test_that_json/api-reference.html)\n\nFor now, see the [`Json`](https://hexdocs.pm/test_that_json/TestThatJson.Json.html) module for docs for much of the API.\n\nThis project has an extensive test suite, so see that for detailed usage.\n\n\n## Helpers\n\n- [X] `has_json_keys`\n- [X] `has_only_json_keys`\n- [X] `has_json_values`\n- [X] `has_only_json_values`\n- [X] `has_json_properties`\n- [X] `has_only_json_properties`\n- [X] `has_json_path`\n- [X] `has_json_size`\n- [X] `has_json_type`\n- [X] `is_json_equal`\n- [X] `load_json`\n- [X] `load_json!`\n- [X] `parse_json`\n- [X] `parse_json!`\n- [X] `prettify_json`\n- [X] `prettify_json!`\n- [X] `to_json`\n- [X] `to_json!`\n- [X] `to_prettified_json`\n- [X] `to_prettified_json!`\n\n\n## Additional Functionality\n\n- [ ] Helpers that return a boolean can optionally take a path\n- [ ] Helpers can be composed together w/ the pipe |\u003e operator\n\n\n## Example\n\n```elixir\ndefmodule MyProject.ExampleTest\n  use ExUnit.Case\n\n  import TestThatJson.Helpers\n\n  test \"verifying JSON key presence\" do\n    json = load_json(\"test/support/json/valid.json\") # example helper use\n\n    assert has_json_keys([\"key1\", \"key2\"])\n  end\nend\n```\n\nTest That JSON! has extensive tests, but they're mostly written as [ESpec](https://github.com/antonmi/espec) specs because I like that style for complex testing. See the `test` directory for some basic happy-path tests, and the `spec` directory for detailed use cases.\n\n\n## Installation\n\n1. Add `test_that_json` as a test-only dependency in `mix.exs`:\n\n  ```elixir\n  def deps do\n    [\n      {:test_that_json, \"~\u003e 0.6.0\", only: :test},\n    ]\n  end\n  ```\n\n\n## Configuration\n\n### Key Exclusion\n\nBy default, to avoid needing to know the values of these ahead of time, the following keys are ignored for all JSON objects: `id`, `inserted_at`, and `updated_at`.\n\nThis can be reconfigured as follows:\n\n``` elixir\nconfig :test_that_json,\n  excluded_keys: ~w(id inserted_at updated_at some other keys)\n```\n\n\n## Paths\n\nThese are simple strings of \"/\"-separated object keys and array indexes passed to `has_json_path`. For instance, with the following JSON:\n\n``` json\n{\n  \"first_name\": \"Jon\",\n  \"last_name\": \"Snow\",\n  \"friends\": [\n    {\n      \"first_name\": \"Know\",\n      \"last_name\": \"Nothing\"\n    }\n  ]\n}\n```\n\nWe could access the first friend's first name with the path \"friends/0/first_name\".\n\n\n## Project Chores\n\n- [X] Tests\n- [ ] Docs for entire helper API\n\n\n## Related Projects\n\n- [DockYard/json_api_assert](https://github.com/DockYard/json_api_assert)\n- [jonasschmidt/ex_json_schema](https://github.com/jonasschmidt/ex_json_schema)\n\n\n## Thanks\n\nThanks to the creators and maintainers of the [Ruby json_spec](https://github.com/collectiveidea/json_spec) project for heavy inspiration.\n\n\n## Contributing\n\n1. Before opening a pull request, please open an issue first.\n2. Do the usual fork/add/fix/run tests dance, or whatever tickles your fancy. Tests are highly encouraged.\n3. Open a PR.\n4. Treat yourself. You deserve it.\n\n\n## License\n\nSee the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshrieken%2Ftest_that_json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshrieken%2Ftest_that_json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshrieken%2Ftest_that_json/lists"}