Skip to content
R

react-json-pretty

A code formatting tool for raw json data

by chenckangFree

#276in UI Libraries
0In stores

Description

react-json-pretty is a small React component that formats and prettifies JSON data for display in the browser. You pass it a data prop that…

Highlights

  • Formats and prettifies JSON in a React component
  • Accepts a JSON string or a plain object
  • Themes through a stylesheet or the theme prop
  • Custom styles for each value type
  • Error callback for JSON.parse errors

Ratings & Reviews

No ratings yet

Be the first to rate react-json-pretty.

People also visit

R

react18-json-view

JSON viewer for react18

UI Libraries
Launch
S

searchable-react-json-view

Interactive react component for displaying javascript arrays and JSON objects

UI Libraries
Launch
U

@uiw/react-json-view

JSON viewer for react

UI Libraries
Launch
J

json-edit-react

React component for editing/viewing JSON/object data

UI Libraries
Launch
J

json-view-cn

A collapsible, syntax-highlighted JSON tree viewer component

UI Libraries
Launch
R

react-json-viewer-cool

React json view plugin, supports expansion and hiding. Uses react hooks

UI Libraries
Launch

react-json-pretty FAQ

What does react-json-pretty do?

It is a lightweight React component that formats and prettifies JSON data for display in the browser.

What data can I pass in?

The data prop takes a JSON string or a plain JavaScript object. If your object is not plain, the README suggests preprocessing it with circular-json or a similar tool.

How do I change the look?

Import a theme through a stylesheet loader such as css-loader in webpack, or use the theme prop, whose values become inline styles. You can also set styles for a specific value type.

How are errors handled?

Pass an onJSONPrettyError function. It receives the errors that JSON.parse throws.

How does it format the output?

It is based on JSON.stringify, so it supports the same replacer and spacing options.

What are the best react-json-pretty alternatives?

Popular alternatives to react-json-pretty include react18-json-view, searchable-react-json-view and @uiw/react-json-view. See all react-json-pretty alternatives

Developer Stuff

Badges