{"id":13734356,"url":"https://github.com/bergant/jsondiff","last_synced_at":"2025-05-16T09:33:54.560Z","repository":{"id":70447514,"uuid":"105789680","full_name":"bergant/jsondiff","owner":"bergant","description":"Compare R Objects as JSONs","archived":false,"fork":false,"pushed_at":"2017-10-05T11:28:50.000Z","size":81,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-01-28T23:08:24.026Z","etag":null,"topics":["diff","htmlwidgets","json","r"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bergant.png","metadata":{"files":{"readme":"readme.Rmd","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}},"created_at":"2017-10-04T16:12:55.000Z","updated_at":"2021-04-21T15:11:13.000Z","dependencies_parsed_at":"2023-02-28T03:46:26.340Z","dependency_job_id":null,"html_url":"https://github.com/bergant/jsondiff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergant%2Fjsondiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergant%2Fjsondiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergant%2Fjsondiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergant%2Fjsondiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bergant","download_url":"https://codeload.github.com/bergant/jsondiff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225420891,"owners_count":17471669,"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":["diff","htmlwidgets","json","r"],"created_at":"2024-08-03T03:00:55.018Z","updated_at":"2024-11-19T20:22:24.668Z","avatar_url":"https://github.com/bergant.png","language":"R","funding_links":[],"categories":["R","UI Components"],"sub_categories":["Code Diff"],"readme":"---\noutput: \n  html_document: \n    keep_md: yes\n    self_contained: no\n---\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, screenshot.force = TRUE, fig.path = \"img/fig-\")\n```\n\n\n\u003cimg src=\"img/jsondiff.png\" align=\"right\" /\u003e\n\n# jsondiff\n\n[![Build Status](https://travis-ci.org/bergant/jsondiff.svg?branch=master)](https://travis-ci.org/bergant/jsondiff)\n\n## Overview\n\n**jsondiff** finds and renders difference in values between JSONs. Diffing R\nobjects (like lists and dataframes) is also supported by automatic conversion \nto JSON. It is implemented as an R interface to\n[jsondiffpatch](https://github.com/benjamine/jsondiffpatch), powered by\n[htmlwidgets](http://www.htmlwidgets.org/) framework.\n\n## Installation \n\n```{r, eval=FALSE}\ndevtools::install_github(\"bergant/jsondiff\")\n```\n\n\n## Usage \n\nCompare two lists:\n\n```{r list, fig.height=1.5}\nx \u003c- list(\n  name = \"Pluto\", orbital_speed_kms = 4.7, category = \"planet\", \n  composition = c(\"methane\", \"nitrogen\")\n)\n\ny \u003c- list(\n  name = \"Pluto\", category = \"dwarf planet\", orbital_speed_kms = 4.7, \n  composition = c(\"nitrogen\", \"methane\", \"carbon monoxide\")\n)\n\nlibrary(jsondiff)\n\njsondiff(x, y)\n```\n\nShow also unchanged data:\n```{r list_unchanged, fig.height=1.5}\njsondiff(x, y, hide_unchanged = FALSE)\n```\n\n\n\nCharacter vectors of size 1 are evaluated as JSONs:\n\n```{r json, fig.height=1.5}\nlibrary(jsonlite)\njson_x \u003c- toJSON(x) \njson_y \u003c- toJSON(y) \n\njsondiff(json_x, json_y)\n```\n\nData frames (example is from\n[daff](https://github.com/edwindj/daff) package, which is probably a better \nchoice to handle difference between data frames than **jsondiff**):\n\n```{r dataframe, fig.height=3}\nx \u003c- y \u003c- iris[1:3,]\n\nx \u003c- head(x,2) # remove a row\nx[1,1] \u003c- 10 # change a value\nx$hello \u003c- \"world\"  # add a column\nx$Species \u003c- NULL # remove a column\n\n\njsondiff(y, x)\n```\n\nNote that there are several options when converting R objects to JSON. Instead\nof using `toJSON` explicitly, one can use `json_options`. For example, \nconverting from data frame to JSON as \"column first\":\n\n```{r dataframe_cols, fig.height=3}\njsondiff(y, x, json_opt = json_options(dataframe = \"columns\", factor = \"string\"))\n```\n\n\n## Related projects\n\nMade possible by:\n\n- [jsondiffpatch](https://github.com/benjamine/jsondiffpatch) - Diffing and patching JSONs (JavaScript library)\n- [htmlwidgets](https://github.com/ramnathv/htmlwidgets) - Framework for easily creating R bindings to JavaScript libraries\n- [jsonlite](https://github.com/jeroen/jsonlite) - A Robust, High Performance JSON Parser and Generator for R \n\nSee also:\n\n- [Daff](https://github.com/edwindj/daff) - Diff, patch and merge for data.frames\n- [listviewer](https://github.com/timelyportfolio/listviewer) - R htmlwidget to view lists\n- [diffobj](https://github.com/brodieG/diffobj) - Compare R Objects with a Diff\n- [tools::Rdiff](https://stat.ethz.ch/R-manual/R-devel/library/tools/html/Rdiff.html): Difference R Output Files\n\n\n## License\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbergant%2Fjsondiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbergant%2Fjsondiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbergant%2Fjsondiff/lists"}