npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-jason

v1.1.2

Published

Render syntax-highlighted JSON data using React. Lightweight.

Readme

react-jason

npm versionnpm bundle size

Render syntax-highlighted JSON data using React. Lightweight.

Check out the demo to see what it can do.

Yes, the name is intentional ;)

Installation

npm install --save react-jason

Usage

import {ReactJason} from 'react-jason'

const jsonData = {
  type: 'author',
  age: 34,
  primaryGenre: null,
  hasPublished: true,
  tags: ['sci-fi', 'fantasy'],
  image: {
    url: 'https://some.url/img.png',
  },
}

export function YourComponent() {
  return <ReactJason value={jsonData} />
}

Theming/styling

We bundle a few different themes, and defining your own styles is actually very simple. The bundled themes are the following:

  • An old hope classic - default (anOldHopeClassic)
  • GitHub (github)
  • Monokai (monokai)
  • Monokai Sublime (monokaiSublime)
  • VS Code Dark (vscodeDark)
  • VS Code Light (vscodeLight)

To use them, import them from react-jason/themes:

import {ReactJason} from 'react-jason'
import github from 'react-jason/themes/github'

const jsonData = {
  /* ... */
}

export function YourComponent() {
  return <ReactJason value={jsonData} theme={github} />
}

To specify your own styles, specify a theme object with either a classes object or a styles object (or both). The keys represent the different node types. See [src/themes/monokai.ts](an existing theme) to figure out the available types.

Props

  • value: any - The JSON data to render. This is the only required property.
  • quoteAttributes: boolean - Whether or not to quote attributes (JSON-style) or remove them where they are not needed (like in javascript). Default is true.
  • theme: object - See theming/styling section above.
  • sortKeys: boolean | function - Whether or not to sort object keys. A custom sorting function can also be provided (same signature as Array.prototype.sort, but receives a third argument - the parent object being sorted)

Switching theme on dark/light mode

import {ReactJason} from 'react-jason'
import {vscodeLight, vscodeDark} from 'react-jason/themes'

const jsonData = {
  /* ... */
}

export function YourComponent() {
  const prefersDarkMode =
    typeof window !== 'undefined' && typeof window.matchMedia === 'function'
      ? window.matchMedia('(prefers-color-scheme: dark)').matches
      : false // use light theme by default?

  const theme = prefersDarkMode ? vscodeDark : vscodeLight

  return <ReactJason value={jsonData} theme={theme} />
}

What's with the name?

react-json was taken 🤷

License

MIT © Espen Hovlandsdal