npm
npmjs.com › package › react-json-view
react-json-view - npm
// import the react-json-view component import ReactJson from 'react-json-view' // use the component in your app! <ReactJson src={my_json_object} /> Install this component with NPM. ... RJV now supports base-16 themes!
» npm install react-json-view
Published Mar 09, 2021
Version 1.21.3
Author Mac Gainor
Repository https://github.com/mac-s-g/react-json-view
GitHub
github.com › uiwjs › react-json-view
GitHub - uiwjs/react-json-view: A React component for displaying and editing javascript arrays and JSON objects.
Advanced Customization - Deep customization example showing how to hide type indicators and quotes for a cleaner MongoDB-like object display (#19) import React from 'react'; import JsonView from '@uiw/react-json-view'; const object = { _id: "ObjectId('13212hakjdhajksd')", uid: "test1", attival_time: new Date('Tue Sep 13 2022 14:07:44 GMT-0500 (Central Daylight Time)'), __v: 0 } export default function Demo() { return ( <JsonView value={object} // keyName="root" displayObjectSize={false} style={{ '--w-rjv-background-color': '#ffffff', }} > <JsonView.Quote render={() => <span />}/> <JsonView.Str
Starred by 398 users
Forked by 23 users
Languages TypeScript 98.0% | HTML 2.0% | TypeScript 98.0% | HTML 2.0%
Videos
React Split
uiwjs.github.io › react-json-view
react-json-view
A React component for displaying and editing javascript arrays and JSON objects.
CodeSandbox
codesandbox.io › examples › package › react-json-view
react-json-view examples - CodeSandbox
AboutInteractive react component for displaying javascript arrays and JSON objects.753,229Weekly Downloads
GitHub
github.com › mac-s-g › react-json-view
GitHub - mac-s-g/react-json-view: JSON viewer for react · GitHub
// import the react-json-view component import ReactJson from 'react-json-view' // use the component in your app!
Starred by 3.7K users
Forked by 500 users
Languages JavaScript 96.4% | Shell 2.9%
CodeSandbox
codesandbox.io › s › react-json-view-4z348
react-json-view - CodeSandbox
August 16, 2020 - react-json-view by rhgrieve using @fortawesome/fontawesome-svg-core, @fortawesome/free-regular-svg-icons, @fortawesome/free-solid-svg-icons, @fortawesome/react-fontawesome, aphrodite, clipboard, prism-react-renderer, react, react-alert
Mac-s-g
mac-s-g.github.io › react-json-view › demo › dist
RJV Demo - react-json-view
Name|Type|Default|Description ... themes in the demo. A custom “rjv-default” theme applies by default. style|object|{}|Style attributes for react-json-view container....
npm
npmjs.com › package › react-json-view-lite
react-json-view-lite - npm
JSON viewer component for React ... 6 months ago. Start using react-json-view-lite in your project by running `npm i react-json-view-lite`. There are 86 other ......
» npm install react-json-view-lite
Published Sep 06, 2025
Version 2.5.0
Author AnyRoad
Snyk
snyk.io › advisor › react-json-view › react-json-view code examples
Top 5 react-json-view Code Examples | Snyk
bluebill1049 / little-state-machine / example / src / src / components / DevToolStateTree.tsx View on Github · import DevToolStorage from './DevToolStorage'; import * as React from 'react'; import { COLORS } from '../constants'; import saveSetting from '../logic/saveSetting'; import { useState } from 'react'; import search from '../logic/filterObject'; const clone = require('lodash.clonedeep'); let ReactJson = (props: any) => <div>; if (typeof window !== 'undefined') { ReactJson = require('react-json-view').default; } const buttonStyle = { margin: '0 10px 0 0', padding: '5px 10px', display: 'inline', fontSize: '12px', border: 'none', borderRadius: '2px', }; const toggleStyle = { borderRadius: 0, display: 'inline', padding: 0, margin: 0,</div>
npm
npmjs.com › package › @uiw › react-json-view
@uiw/react-json-view - npm
import JsonView from '@uiw/react-json-view'; const avatar = 'https://i.imgur.com/MK3eW3As.jpg'; const longArray = new Array(1000).fill(1); const example = { avatar, string: 'Lorem ipsum dolor sit amet', integer: 42, float: 114.514, bigint: 10086n, null: null, undefined, timer: 0, date: new Date('Tue Sep 13 2022 14:07:44 GMT-0500 (Central Daylight Time)'), array: [19, 100.86, 'test', NaN, Infinity], nestedArray: [ [1, 2], [3, 4], ], object: { 'first-child': true, 'second-child': false, 'last-child': null, }, longArray, string_number: '1234', }; <JsonView value={example} /> By default, the lightTheme light theme is used, and a darkTheme dark theme configuration is built in ·
» npm install @uiw/react-json-view
Published Jan 20, 2026
Version 2.0.0-alpha.41
Author Kenny Wang
Repository https://github.com/uiwjs/react-json-view
GitHub
github.com › microlinkhq › react-json-view
GitHub - microlinkhq/react-json-view: JSON viewer for React · GitHub
import ReactJsonView from '@microlink/react-json-view' <ReactJsonView src={{ string: 'this is a test string', integer: 42, array: [1, 2, 3, 'test', NaN], float: 3.14159, undefined: undefined, object: { 'first-child': true, 'second-child': false, 'last-child': null }, string_number: '1234', date: new Date(), bigNumber: new BigNumber('0.0060254656709730629123') }} showComma />
Starred by 382 users
Forked by 67 users
Languages JavaScript 99.5% | SCSS 0.5%
GitHub
github.com › YYsuni › react18-json-view
GitHub - YYsuni/react18-json-view: JSON viewer for react18
React.FC / React.Component <{ onClick: (event: React.MouseEvent) => void; className: string ; style: React.CSSProperties}> ... Customize copy icon. ... Customize copied icon. ... ;(params: { node: Record<string, any> | Array<any> // Object or array indexOrName: number | string | undefined depth: number size: number // Object's size or array's length }) => boolean ... onEdit, OnDelete, onAdd and OnChange add parentPath field, allow us to correctly indicate which field in the JSON is being edited.
Starred by 334 users
Forked by 31 users
Languages TypeScript 94.6% | CSS 3.8% | JavaScript 1.6% | TypeScript 94.6% | CSS 3.8% | JavaScript 1.6%
CloudDefense.ai
clouddefense.ai › code › javascript › example › react-json-view
Top 10 Examples of react-json-view code in Javascript
render() { // eslint-disable-next-line no-undef const ReactJson = require('react-json-view').default const { src } = this.props const StyledReactJsonContainer = styled.div` .string-value { text-overflow: ellipsis; max-width: 800px; overflow: hidden; display: inline-block; } ` return ( )
npm
npmjs.com › package › react18-json-view
react18-json-view - npm
onEdit, OnDelete, onAdd and OnChange add parentPath field, allow us to correctly indicate which field in the JSON is being edited. (params: { node: any; indexOrName: number | string | undefined; depth: number }) => | { add?: boolean edit?: boolean delete?: boolean enableClipboard?: boolean collapsed?: boolean className?: string } | React.FC | typeof React.Component | React.ReactElement<any, any>
» npm install react18-json-view
Published Feb 19, 2025
Version 0.2.9
Author Suni
Repository https://github.com/YYsuni/react18-json-view
Snyk
snyk.io › advisor › react-json-view › functions › react-json-view.default
How to use the react-json-view.default function in react-json-view | Snyk
bluebill1049 / little-state-machine / example / src / src / components / DevToolStateTree.tsx View on Github · import DevToolStorage from './DevToolStorage'; import * as React from 'react'; import { COLORS } from '../constants'; import saveSetting from '../logic/saveSetting'; import { useState } from 'react'; import search from '../logic/filterObject'; const clone = require('lodash.clonedeep'); let ReactJson = (props: any) => <div>; if (typeof window !== 'undefined') { ReactJson = require('react-json-view').default; } const buttonStyle = { margin: '0 10px 0 0', padding: '5px 10px', display: 'inline', fontSize: '12px', border: 'none', borderRadius: '2px', }; const toggleStyle = { borderRadius: 0, display: 'inline', padding: 0, margin: 0,</div>
Microlink
react-json-view.microlink.io
react-json-view
react-json-view: A React component for displaying and editing JSON data in a tree view format.
GitHub
github.com › HuolalaTech › react-json-view
GitHub - HuolalaTech/react-json-view: <ReactJsonView /> is a react component for displaying serializable data.
imoprt React from 'react'; import ReactDOM from 'react-dom'; import ReactJsonView from '@huolala-tech/react-json-view'; import '@huolala-tech/react-json-view/dist/style.css'; const data = [1,2,3,4] const App = () => { return ( <div id="app"> <ReactJsonView source={data} darkMode={false} rootLabel="Response data" keyCount={200} defaultExpand={false} maxTitleSize={100} /> </div> ); }; ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root') as HTMLElement )
Author HuolalaTech
CodeSandbox
codesandbox.io › examples › package › react-json-view-lite
react-json-view-lite examples - CodeSandbox
Use this online react-json-view-lite playground to view and fork react-json-view-lite example apps and templates on CodeSandbox.
Top answer 1 of 7
375
You'll need to either insert BR tag appropriately in the resulting string, or use for example a PRE tag so that the formatting of the stringify is retained:
var data = { a: 1, b: 2 };
var Hello = React.createClass({
render: function() {
return <div><pre>{JSON.stringify(data, null, 2) }</pre></div>;
}
});
React.render(<Hello />, document.getElementById('container'));
Working example.
Update
class PrettyPrintJson extends React.Component {
render() {
// data could be a prop for example
// const { data } = this.props;
return (<div><pre>{JSON.stringify(data, null, 2) }</pre></div>);
}
}
ReactDOM.render(<PrettyPrintJson/>, document.getElementById('container'));

Stateless Functional component, React .14 or higher
const PrettyPrintJson = ({data}) => {
// (destructured) data could be a prop for example
return (<div><pre>{ JSON.stringify(data, null, 2) }</pre></div>);
}
Or, ...
const PrettyPrintJson = ({data}) => (<div><pre>{
JSON.stringify(data, null, 2) }</pre></div>);
Working example
Memo / 16.6+
(You might even want to use a memo, 16.6+)
const PrettyPrintJson = React.memo(({data}) => (<div><pre>{
JSON.stringify(data, null, 2) }</pre></div>));
2 of 7
64
TLDR
Pretty Print JSON in JavaScript and React
<pre>{JSON.stringify(data, null, 2)}</pre>