{"name":"react-json-tree","version":"0.20.0","description":"React JSON Viewer Component, Extracted from redux-devtools","keywords":["react","json viewer"],"homepage":"https://github.com/reduxjs/redux-devtools/tree/master/packages/react-json-tree","bugs":{"url":"https://github.com/reduxjs/redux-devtools/issues"},"license":"MIT","author":{"name":"Shu Uesugi","email":"shu@chibicode.com","url":"http://github.com/chibicode"},"contributors":[{"name":"Alexander Kuznetsov","email":"alexkuz@gmail.com","url":"http://kuzya.org/"},{"name":"Dave Vedder","email":"veddermatic@gmail.com","url":"http://www.eskimospy.com/"},{"name":"Daniele Zannotti","email":"dzannotti@me.com","url":"http://www.github.com/dzannotti"},{"name":"Mihail Diordiev","email":"zalmoxisus@gmail.com","url":"https://github.com/zalmoxisus"}],"main":"lib/index.js","types":"lib/index.d.ts","type":"module","sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/reduxjs/redux-devtools.git"},"dependencies":{"@types/lodash":"^4.17.15","react-base16-styling":"^0.10.0"},"devDependencies":{"@types/jest":"^29.5.14","@types/react":"^18.3.18","@types/react-test-renderer":"^18.3.1","jest":"^29.7.0","react":"^18.3.1","react-test-renderer":"^18.3.1","rimraf":"^6.0.1","ts-jest":"^29.2.6","typescript":"~5.7.3"},"peerDependencies":{"@types/react":"^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0","react":"^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"},"scripts":{"build":"tsc","clean":"rimraf lib","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js","lint":"eslint .","type-check":"tsc --noEmit","prepublish":"pnpm run lint && pnpm run test"},"_id":"react-json-tree@0.20.0","_integrity":"sha512-h+f9fUNAxzBx1rbrgUF7+zSWKGHDtt2VPYLErIuB0JyKGnWgFMM21ksqQyb3EXwXNnoMW2rdE5kuAaubgGOx2Q==","_resolved":"/tmp/87c49537f1a6518b45c579413cf3e99d/react-json-tree-0.20.0.tgz","_from":"file:react-json-tree-0.20.0.tgz","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-h+f9fUNAxzBx1rbrgUF7+zSWKGHDtt2VPYLErIuB0JyKGnWgFMM21ksqQyb3EXwXNnoMW2rdE5kuAaubgGOx2Q==","shasum":"1e7fd26f093bd49d733f80dd9b6d40142e09f7c9","tarball":"http://registry-npm.ywwl.com/react-json-tree/download/react-json-tree-0.20.0.tgz","fileCount":45,"unpackedSize":63210,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIETTpvPHDARmpTnL60jv+cBwFAdEvHS1XoUm0wzsl2dhAiEAzx+7C1yCv0cop9LtuXHQ+WkgJx8heIf+blqUiLTfTfY="}],"size":16891,"noattachment":false,"key":"/react-json-tree/-/react-json-tree-0.20.0.tgz"},"_npmUser":{"name":"methuselah96","email":"nbierema@gmail.com"},"directories":{},"maintainers":[{"name":"chibicode","email":"shu.chibicode@gmail.com"},{"name":"gaearon","email":"dan.abramov@gmail.com"},{"name":"timdorr","email":"timdorr@timdorr.com"},{"name":"alexkuz","email":"alexkuz@gmail.com"},{"name":"zalmoxisus","email":"zalmoxisus@gmail.com"},{"name":"methuselah96","email":"nbierema@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-json-tree_0.20.0_1740849192171_0.6835560820583335"},"_hasShrinkwrap":false,"readme":"# react-json-tree\n\nReact JSON Viewer Component, Extracted from [redux-devtools](https://github.com/reduxjs/redux-devtools). Supports [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable) objects, such as [Immutable.js](https://facebook.github.io/immutable-js/).\n\n![](https://img.shields.io/npm/v/react-json-tree.svg)\n\n### Usage\n\n```jsx\nimport { JSONTree } from 'react-json-tree';\n// If you're using Immutable.js: `npm i --save immutable`\nimport { Map } from 'immutable';\n\n// Inside a React component:\nconst json = {\n  array: [1, 2, 3],\n  bool: true,\n  object: {\n    foo: 'bar',\n  },\n  immutable: Map({ key: 'value' }),\n};\n\n<JSONTree data={json} />;\n```\n\n#### Result:\n\n![](https://i.ibb.co/0KSYRJg/example-result.png)\n\nCheck out [examples](examples) directory for more details.\n\n### Theming\n\nThis component now uses [react-base16-styling](https://github.com/reduxjs/redux-devtools/tree/main/packages/react-base16-styling) module, which allows to customize component via `theme` property, which can be the following:\n\n- [base16](https://github.com/chriskempson/base16) theme data. [The example theme data can be found here](https://github.com/gaearon/redux-devtools/tree/75322b15ee7ba03fddf10ac3399881e302848874/src/react/themes).\n- object that contains style objects, strings (that treated as classnames) or functions. A function is used to extend its first argument `{ style, className }` and should return an object with the same structure. Other arguments depend on particular context (and should be described here). See [createStylingFromTheme.js](https://github.com/reduxjs/redux-devtools/blob/main/packages/react-json-tree/src/createStylingFromTheme.ts) for the list of styling object keys. Also, this object can extend `base16` theme via `extend` property.\n\nEvery theme has a light version, which is enabled with `invertTheme` prop.\n\n```jsx\nconst theme = {\n  scheme: 'monokai',\n  author: 'wimer hazenberg (http://www.monokai.nl)',\n  base00: '#272822',\n  base01: '#383830',\n  base02: '#49483e',\n  base03: '#75715e',\n  base04: '#a59f85',\n  base05: '#f8f8f2',\n  base06: '#f5f4f1',\n  base07: '#f9f8f5',\n  base08: '#f92672',\n  base09: '#fd971f',\n  base0A: '#f4bf75',\n  base0B: '#a6e22e',\n  base0C: '#a1efe4',\n  base0D: '#66d9ef',\n  base0E: '#ae81ff',\n  base0F: '#cc6633',\n};\n\n<div>\n  <JSONTree data={data} theme={theme} invertTheme={false} />\n</div>;\n```\n\n#### Result (Monokai theme, dark background):\n\n![](http://cl.ly/image/330o2L1J3V0h/screenshot%202015-08-26%20at%2010.48.24%20AM.png)\n\n#### Advanced Customization\n\n```jsx\n<div>\n  <JSONTree\n    data={data}\n    theme={{\n      extend: theme,\n      // underline keys for literal values\n      valueLabel: {\n        textDecoration: 'underline',\n      },\n      // switch key for objects to uppercase when object is expanded.\n      // `nestedNodeLabel` receives additional argument `expandable`\n      nestedNodeLabel: ({ style }, keyPath, nodeType, expanded) => ({\n        style: {\n          ...style,\n          textTransform: expanded ? 'uppercase' : style.textTransform,\n        },\n      }),\n    }}\n  />\n</div>\n```\n\n#### Customize Labels for Arrays, Objects, and Iterables\n\nYou can pass `getItemString` to customize the way arrays, objects, and iterable nodes are displayed (optional).\n\nBy default, it'll be:\n\n```jsx\n<JSONTree getItemString={(type, data, itemType, itemString, keyPath)\n  => <span>{itemType} {itemString}</span>}\n```\n\nBut if you pass the following:\n\n```jsx\nconst getItemString = (type, data, itemType, itemString, keyPath)\n  => (<span> // {type}</span>);\n```\n\nThen the preview of child elements now look like this:\n\n![](http://cl.ly/image/1J1a0b0T0K3c/screenshot%202015-10-07%20at%203.44.31%20PM.png)\n\n#### Customize Rendering\n\nYou can pass the following properties to customize rendered labels and values:\n\n```jsx\n<JSONTree\n  labelRenderer={([key]) => <strong>{key}</strong>}\n  valueRenderer={(raw) => <em>{raw}</em>}\n/>\n```\n\nIn this example the label and value will be rendered with `<strong>` and `<em>` wrappers respectively.\n\nFor `labelRenderer`, you can provide a full path - [see this PR](https://github.com/chibicode/react-json-tree/pull/32).\n\nTheir full signatures are:\n\n- `labelRenderer: function(keyPath, nodeType, expanded, expandable)`\n- `valueRenderer: function(valueAsString, value, ...keyPath)`\n\n#### More Options\n\n- `shouldExpandNodeInitially: function(keyPath, data, level)` - determines if node should be expanded when it first renders (root is expanded by default)\n- `hideRoot: boolean` - if `true`, the root node is hidden.\n- `sortObjectKeys: boolean | function(a, b)` - sorts object keys with compare function (optional). Isn't applied to iterable maps like `Immutable.Map`.\n- `postprocessValue: function(value)` - maps `value` to a new `value`\n- `isCustomNode: function(value)` - overrides the default object type detection and renders the value as a single value\n- `collectionLimit: number` - sets the number of nodes that will be rendered in a collection before rendering them in collapsed ranges\n- `keyPath: (string | number)[]` - overrides the initial key path for the root node (defaults to `[root]`)\n\n### Credits\n\n- All credits to [Dave Vedder](http://www.eskimospy.com/) ([veddermatic@gmail.com](mailto:veddermatic@gmail.com)), who wrote the original code as [JSONViewer](https://bitbucket.org/davevedder/react-json-viewer/).\n- Extracted from [redux-devtools](https://github.com/gaearon/redux-devtools), which contained ES6 + inline style port of [JSONViewer](https://bitbucket.org/davevedder/react-json-viewer/) by [Daniele Zannotti](http://www.github.com/dzannotti) ([dzannotti@me.com](mailto:dzannotti@me.com))\n- [Iterable support](https://github.com/gaearon/redux-devtools/pull/79) thanks to [Daniel K](https://github.com/FredyC).\n- npm package created by [Shu Uesugi](http://github.com/chibicode) ([shu@chibicode.com](mailto:shu@chibicode.com)) per [this issue](https://github.com/gaearon/redux-devtools/issues/85).\n- Improved and maintained by [Alexander Kuznetsov](https://github.com/alexkuz). The repository was merged into [`redux-devtools` monorepo](https://github.com/reduxjs/redux-devtools) from [`alexkuz/react-json-tree`](https://github.com/alexkuz/react-json-tree).\n\n### Similar Libraries\n\n- [react-treeview](https://github.com/chenglou/react-treeview)\n- [react-json-inspector](https://github.com/Lapple/react-json-inspector)\n- [react-object-inspector](https://github.com/xyc/react-object-inspector)\n- [react-json-view](https://github.com/mac-s-g/react-json-view)\n\n### License\n\nMIT\n","publish_time":1740849192363,"_cnpm_publish_time":1740849192363,"dist-tags":{"latest":"0.20.0"}}