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

Force reformatting to always put double quotes around keys

Open StefanoSega opened this issue 7 years ago • 9 comments

  1. What version of RJEA are you using (react-json-editor-ajrm version)? *REQUIRED 2.5.8
  2. What operating system and processor architecture are you using? *REQUIRED MacOS Sierra
  3. What did you do? *REQUIRED I copy/pasted this json:
{
"a": 2,
"xxx": "Hi"
}
  1. What did you expect to see? *REQUIRED I expected to have the json in the editor formatted but still keeping the quotes around the key names
  2. What did you see instead? *REQUIRED The keys lose the quotes around them. This creates problem for users that want to copy from the editor and paste the json object elsewhere. Is there a option to keep the quotes around the keys?

StefanoSega avatar Nov 29 '18 14:11 StefanoSega

Hello @StefanoSega

Thanks for reporting this. As you noticed this is currently intended behavior. Quotes are only added if required (e.g. due to a space in the key name).

I'll flag this as feature request and maybe we'll get to it at some point in the future. However we're in dire need of collaborators so I cannot give you an estimated timeframe.

SachsKaylee avatar Dec 01 '18 11:12 SachsKaylee

Extra vote here. We have the same issue, so would be glad if this is changed. It's not just a visualisation issue, it's very important to have strict JSON to be able to copy/paste between systems.

Double quotes are required according to the strict JSON standard:

  • http://www.json.org/
  • https://jsonlint.com/

Make sure you follow JSON's syntax properly. For example, always use double quotes, always quotify your keys, and remove all callback functions.

  • https://stackoverflow.com/questions/949449/do-the-json-keys-have-to-be-surrounded-by-quotes

Quotes are also changed to single quotes, which is also not valid strict JSON.

filiphoeven avatar Mar 15 '19 10:03 filiphoeven

i need this issue to solve too . I think it will be great if it can still accept double quote mark so it did not confuse someone that familiar with JSON standard

rafifahlevi avatar Jul 02 '19 02:07 rafifahlevi

Note that it would also be OK if COPY (from copy/paste) would add these single/double quotes for keys and PASTE would remove them if they were in.

filiphoeven avatar Aug 23 '19 10:08 filiphoeven

Hello! +100500 quotes to this. It is critical functional for json editor. For now it is not JSON editor. It is just JS-object editor. It converts json to js forcibly and not configurable and after this you edit js-object and not json. Unable to copy past and verify json with this JS editor because of that. Seeing this issue and it's date and thinking we now need to find something different. People past real valid json into this editor and complain because of parse errors - it's a bug.

rusekr avatar Sep 17 '19 11:09 rusekr

This is valid feedback. I will see if we can have this updated.

AndrewRedican avatar Aug 25 '20 09:08 AndrewRedican

Hi, Was this fixed? Facing the same issue here!

csseba avatar Nov 03 '21 17:11 csseba

Hi @AndrewRedican ,

Any updates on the issue? Still seeing the same issue.

shubham88fru avatar Nov 20 '21 18:11 shubham88fru

First of all, awesome project!

Any progress on this though? Currently this JSON editor doesn't accept or show JSON, it shows javascript objects.

placeholder={JSON.stringify({a:1})} should not fail. all keys should be doublequote-wrapped.

If the project were called "Javascript Object Editor" There'd be no issue 😄

thanks for you work!

made-by-chris avatar Feb 03 '22 14:02 made-by-chris

I no longer intend to update this project. I am working instead on a complete rewrite.

I'd like to thank you for using and taking interest in this project.

I also would like to apologize for not following up sooner. However, do realize for the most part this has been a one-man show, and the occasional contributions I used to receive. What I am saying is, I am in dire need of volunteers.

If this is something you would be interested in participating in, you can join in the discussion.

I've taken note of this thread, and I'll keep this under consideration for the new project.

AndrewRedican avatar Jan 29 '23 03:01 AndrewRedican