react-json-editor-ajrm icon indicating copy to clipboard operation
react-json-editor-ajrm copied to clipboard

JSONInput does not handle HTML entities properly

Open jluxenberg opened this issue 2 years ago • 0 comments

What version of RJEA are you using (react-json-editor-ajrm version)? 2.5.13

What operating system and processor architecture are you using? MacOS / ARM

What did you do? Instantiate JSONInput with an object having an HTML entity e.g. & like this:

import JSONInput from "react-json-editor-ajrm";
import locale from "react-json-editor-ajrm/locale/en";

export default function App() {
  const sampleObject = {
    a: "&"
  };
  return (
    <div className="App">
      <JSONInput
        id="a_unique_id"
        placeholder={sampleObject}
        locale={locale}
        height="550px"
      />
    </div>
  );
}

What did you expect to see?

I expect to see a JSON editor with the following object:

{
  a: '&amp;'
}

What did you see instead?

Instead, I see a JSON editor that looks like this

{
  a: '&'
}

Here's a CodeSandbox and a screenshot of the output I'm seeing: https://codesandbox.io/s/withered-water-lww2ik?file=/src/App.js

CleanShot 2022-03-23 at 15 48 21

jluxenberg avatar Mar 23 '22 22:03 jluxenberg