question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quote keys containing special characters

See original GitHub issue
  1. What version of RJEA are you using (react-json-editor-ajrm version)?

v2.4.4

  1. What operating system and processor architecture are you using?

Mac OS

  1. What did you do?

Tried to edit a JSON object whose keys have “special characters”.

  1. What did you expect to see?

An properly editable object

  1. What did you see instead?

image

In the above screenshot, when I changed the value of state to paused, the error shows up for line 4. I can temporarily fix the error by manually putting the key in quotes (i.e. '10018-00'), but then the next key that starts with a number or contains other special characters gets marked as an error.

Could you please provide a fix to this? One possible fix would be to always quote keys that will cause parsing errors if left unquoted; or to just always quote keys.

Cheers!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
AndrewRedicancommented, Jul 15, 2018

Hey @ellis, special key names that require to be wrapped in quotes now do. Hey @PatrickSachs, quotes in keys are now escaped.

This fixes are available in the latest version of react-json-editor-ajrm@2.4.7

2reactions
PatrickSachscommented, Jul 14, 2018

Since this is probably the same issue, quotes in keys also need to be escaped:

{
  "oh i don't have any channels": {
    "desc": "That kinda explains why the channels list was empty... Mhm...",
    "lang": 0,
    "type": 0,
    "set": 0
  },
  "test standard channel": {
    "desc": "\"Testing if quoted strings are really required.\",Mhhh...",
    "lang": 0,
    "type": 0,
    "set": 1
  }
}

Creates the following output: (Syntax Error in the second line: Missing closing ' quote on key at line 2)

{
  'oh i don't have any channels': {
    desc: 'That kinda explains why the channels list was empty... Mhm...',
    lang: 0,
    type: 0,
    set: 0
  },
  'test standard channel': {
    desc: '"Testing if quoted strings are really required.",Mhhh...',
    lang: 0,
    type: 0,
    set: 0
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Special Characters – iA
You can type many special characters, including diacritics and “”-style quotation marks, using keyboard shortcuts. The shortcuts vary with keyboard layout, ...
Read more >
Using Quotes with YAML Special Characters
Use quotes in YAML if your value includes special characters. ... special character is surrounded by spaces, for example, * with spaces on...
Read more >
Special Characters and Quoting - Learning the bash ... - O'Reilly
Sometimes you will want to use special characters literally, i.e., without their special meanings. This is called quoting. If you surround a string...
Read more >
3.3. Quoting characters
A lot of keys have special meanings in some context or other. Quoting is used to remove the special meaning of characters or...
Read more >
ASCII and Unicode quotation marks
If you can use Unicode characters, nice directional quotation marks are available in the form of characters U+2018, U+2019, U+201C, and U+201D (as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found