Gathering detailed insights and metrics for @arextest/vanilla-jsoneditor
Gathering detailed insights and metrics for @arextest/vanilla-jsoneditor
Gathering detailed insights and metrics for @arextest/vanilla-jsoneditor
Gathering detailed insights and metrics for @arextest/vanilla-jsoneditor
A web-based tool to view, edit, format, repair, query, transform, and validate JSON
npm install @arextest/vanilla-jsoneditor
Typescript
Module System
Node Version
NPM Version
TypeScript (54.43%)
Svelte (36.26%)
SCSS (6.21%)
HTML (1.33%)
JavaScript (1.22%)
CSS (0.56%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
1,081 Stars
1,278 Commits
125 Forks
8 Watchers
4 Branches
21 Contributors
Updated on Jul 11, 2025
Latest Version
0.23.0
Package Id
@arextest/vanilla-jsoneditor@0.23.0
Unpacked Size
8.87 MB
Size
2.41 MB
File Count
13
NPM Version
10.2.4
Node Version
21.5.0
Published on
Mar 11, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
25
A web-based tool to view, edit, format, transform, and validate JSON.
Try it out: https://jsoneditoronline.org
This is the vanilla variant of svelte-jsoneditor
, which can be used in vanilla JavaScript or frameworks like SolidJS, React, Vue, Angular.
Install using npm:
npm install vanilla-jsoneditor
Remark: for usage in a Svelte project, install and use svelte-jsoneditor
instead of vanilla-jsoneditor
.
If you have a setup for your project with a bundler (like Vite, Rollup, or Webpack), it is best to use the default ES import:
1// for use in a React, Vue, or Angular project 2import { JSONEditor } from 'vanilla-jsoneditor'
If you want to use the library straight in the browser, use the provided standalone ES bundle:
1// for use directly in the browser 2import { JSONEditor } from 'vanilla-jsoneditor/standalone.js'
The standalone bundle contains all dependencies of vanilla-jsoneditor
, for example lodash-es
and Ajv
. If you use some of these dependencies in your project too, it means that they will be bundled twice in your web application, leading to a needlessly large application size. In general, it is preferable to use the default import { JSONEditor } from 'vanilla-jsoneditor'
so dependencies can be reused.
1<!doctype html> 2<html lang="en"> 3 <head> 4 <title>JSONEditor</title> 5 </head> 6 <body> 7 <div id="jsoneditor"></div> 8 9 <script type="module"> 10 import { JSONEditor } from 'vanilla-jsoneditor/standalone.js' 11 12 // Or use it through a CDN (not recommended for use in production): 13 // import { JSONEditor } from 'https://unpkg.com/vanilla-jsoneditor/index.js' 14 // import { JSONEditor } from 'https://cdn.jsdelivr.net/npm/vanilla-jsoneditor/index.js' 15 16 let content = { 17 text: undefined, 18 json: { 19 greeting: 'Hello World' 20 } 21 } 22 23 const editor = new JSONEditor({ 24 target: document.getElementById('jsoneditor'), 25 props: { 26 content, 27 onChange: (updatedContent, previousContent, { contentErrors, patchResult }) => { 28 // content is an object { json: JSONData } | { text: string } 29 console.log('onChange', { updatedContent, previousContent, contentErrors, patchResult }) 30 content = updatedContent 31 } 32 } 33 }) 34 35 // use methods get, set, update, and onChange to get data in or out of the editor. 36 // Use updateProps to update properties. 37 </script> 38 </body> 39</html>
Depending on whether you are using JavaScript of TypeScript, create either a JSX or TSX file:
1// 2// JSONEditorReact.tsx 3// 4import { useEffect, useRef } from 'react' 5import { JSONEditor, JSONEditorPropsOptional } from 'vanilla-jsoneditor' 6 7const JSONEditorReact: React.FC<JSONEditorPropsOptional> = (props) => { 8 const refContainer = useRef<HTMLDivElement>(null) 9 const refEditor = useRef<JSONEditor | null>(null) 10 11 useEffect(() => { 12 // create editor 13 refEditor.current = new JSONEditor({ 14 target: refContainer.current!, 15 props: {} 16 }) 17 18 return () => { 19 // destroy editor 20 if (refEditor.current) { 21 refEditor.current.destroy() 22 refEditor.current = null 23 } 24 } 25 }, []) 26 27 useEffect(() => { 28 // update props 29 if (refEditor.current) { 30 refEditor.current.updateProps(props) 31 } 32 }, [props]) 33 34 return <div ref={refContainer} /> 35} 36 37export default JSONEditorReact
1// 2// JSONEditorReact.jsx 3// 4import { useEffect, useRef } from 'react' 5import { JSONEditor, JSONEditorPropsOptional } from 'vanilla-jsoneditor' 6 7const JSONEditorReact = (props) => { 8 const refContainer = useRef(null) 9 const refEditor = useRef(null) 10 11 useEffect(() => { 12 // create editor 13 refEditor.current = new JSONEditor({ 14 target: refContainer.current, 15 props: {} 16 }) 17 18 return () => { 19 // destroy editor 20 if (refEditor.current) { 21 refEditor.current.destroy() 22 refEditor.current = null 23 } 24 } 25 }, []) 26 27 // update props 28 useEffect(() => { 29 if (refEditor.current) { 30 refEditor.current.updateProps(props) 31 } 32 }, [props]) 33 34 return <div ref={refContainer} /> 35} 36 37export default JSONEditorReact
If you are using NextJS, you will need to use a dynamic import to only render the component in the browser (disabling server-side rendering of the wrapper), as shown below in a NextJS TypeScript example.
If you are using React in an conventional non-NextJS browser app, you can import the component using a standard import statement like import JSONEditorReact from '../JSONEditorReact'
1// 2// demo.tsx for use with NextJS 3// 4import dynamic from 'next/dynamic' 5import { useCallback, useState } from 'react' 6 7// 8// In NextJS, when using TypeScript, type definitions 9// can be imported from 'vanilla-jsoneditor' using a 10// conventional import statement (prefixed with 'type', 11// as shown below), but only types can be imported this 12// way. When using NextJS, React components and helper 13// functions must be imported dynamically using { ssr: false } 14// as shown elsewhere in this example. 15// 16import type { Content, OnChangeStatus } from 'vanilla-jsoneditor' 17 18// 19// In NextJS, the JSONEditor component must be wrapped in 20// a component that is dynamically in order to turn off 21// server-side rendering of the component. This is neccessary 22// because the vanilla-jsoneditor code attempts to use 23// browser-only JavaScript capabilities not available 24// during server-side rendering. Any helper functions 25// provided by vanilla-jsoneditor, such as toTextContent, 26// must also only be used in dynamically imported, 27// ssr: false components when using NextJS. 28// 29const JSONEditorReact = dynamic(() => import('../JSONEditorReact'), { ssr: false }) 30const TextContent = dynamic(() => import('../TextContent'), { ssr: false }) 31 32const initialContent = { 33 hello: 'world', 34 count: 1, 35 foo: ['bar', 'car'] 36} 37 38export default function Demo() { 39 const [jsonContent, setJsonContent] = useState<Content>({ json: initialContent }) 40 const handler = useCallback( 41 (content: Content, previousContent: Content, status: OnChangeStatus) => { 42 setJsonContent(content) 43 }, 44 [jsonContent] 45 ) 46 47 return ( 48 <div> 49 <JSONEditorReact content={jsonContent} onChange={handler} /> 50 <TextContent content={jsonContent} /> 51 </div> 52 ) 53}
1// 2// TextContent.tsx 3// 4// (wrapper around toTextContent for use with NextJS) 5// 6import { Content, toTextContent } from 'vanilla-jsoneditor' 7 8interface IOwnProps { 9 content: Content 10} 11const TextContent = (props: IOwnProps) => { 12 const { content } = props 13 14 return ( 15 <p> 16 The contents of the editor, converted to a text string, are: {toTextContent(content).text} 17 </p> 18 ) 19} 20 21export default TextContent
No vulnerabilities found.
Reason
12 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Project has not signed or included provenance with any releases.
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More