You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 22, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 22, 2026. It is now read-only.
can please update the dependency to be compatible to the lastest version of react (18). Otherwise npm i fails with latest npm.
Reacted by Trevor Healy, Erij Maherzia BEN BRAHIM, mitoihs, Matthias Ludwig, Cristian Saraiva, Marcel Maas, Ben Kiggen, Mark Hampton, Jean-Paul Manuel, MarisaCodes and 12 more
In this TypeScript version, we have defined an interface JSONEditorComponentProps for the props that the JSONEditorComponent accepts, and we've used React.FC to define the type of the component. Also, jsonEditor and containerRef variables are defined with their specific types.
Here is how you can use the JSONEditorComponent:
import React from "react";
import JSONEditorComponent from "./JSONEditorComponent";
const App: React.FC = () => {
const data = {
"name": "John",
"age": 30,
"city": "New York"
};
return <JSONEditorComponent jsonData={data} />;
};
export default App;
Reacted by MarisaCodes, Joshua McLauchlan, tholeb and Bogon Park
In this TypeScript version, we have defined an interface JSONEditorComponentProps for the props that the JSONEditorComponent accepts, and we've used React.FC to define the type of the component. Also, jsonEditor and containerRef variables are defined with their specific types.
Here is how you can use the JSONEditorComponent:
import React from "react";
import JSONEditorComponent from "./JSONEditorComponent";
const App: React.FC = () => {
const data = {
"name": "John",
"age": 30,
"city": "New York"
};
return <JSONEditorComponent jsonData={data} />;
};
export default App;
This almost feels like it should just be a new repo / npm package :D
Thanks for the sample code, working on a slightly modified version that enables you to pass in options, utilize onChange and value in a react controlled input fashion.
In this TypeScript version, we have defined an interface JSONEditorComponentProps for the props that the JSONEditorComponent accepts, and we've used React.FC to define the type of the component. Also, jsonEditor and containerRef variables are defined with their specific types.
Here is how you can use the JSONEditorComponent:
import React from "react";
import JSONEditorComponent from "./JSONEditorComponent";
const App: React.FC = () => {
const data = {
"name": "John",
"age": 30,
"city": "New York"
};
return <JSONEditorComponent jsonData={data} />;
};
export default App;
Thanks, this was really useful. I've updated it to be able to extract the data out on every keypress:
Activity
mattqs commentedon Jul 6, 2023
I had the same problem with React 18 and found this fix:
Next, here's the JSONEditorComponent:
In this TypeScript version, we have defined an interface JSONEditorComponentProps for the props that the JSONEditorComponent accepts, and we've used React.FC to define the type of the component. Also, jsonEditor and containerRef variables are defined with their specific types.
Here is how you can use the JSONEditorComponent:
bkiggen commentedon Aug 30, 2023
Came to request the same thing. This is a great package - thanks to the devs working on it!
MarisaCodes commentedon Oct 14, 2023
this was very helpful thanks
Jezternz commentedon Jan 31, 2024
This almost feels like it should just be a new repo / npm package :D
Thanks for the sample code, working on a slightly modified version that enables you to pass in options, utilize onChange and value in a react controlled input fashion.
Jezternz commentedon Feb 3, 2024
Ended up just going with a custom js and no longer using jsoneditor-react, can see source here if interested:
https://gist.github.com/Jezternz/fd2edd87f9b31c66eb9258d75afed600
markAtHub commentedon Aug 22, 2024
Thanks, this was really useful. I've updated it to be able to extract the data out on every keypress: