Skip to content

Imposible to escape back unescaped multiline json text #252

@krokwen

Description

@krokwen

Describe the bug
Impossible to escape back unescaped json text. In any case: on whole document, on key-value pair, on exact value.

To Reproduce
Steps to reproduce the behavior:

  1. Create a json like
{
  "key": "my\n multiline\n value"
}
  1. Apply "unescape JSON" on whole document
  2. See
{
  "key": "my
 multiline
 value"
}
  1. Select whole document and apply "escape JSON"
  2. See that instead of escaping back multiline value there was escaped quotes on key and value:
{
  \"key\": \"my
 multiline
 value\"
}
  1. Rollback, try to apply "escape JSON" on key-value part, get same result as on 7
  2. Rollback, try to apply "escape JSON" on value in quotes
  3. See nothing changed

Expected behavior
Multiline text escaped back into single line with replaced new line (\n) with literal '\n'

Environment :
PyCharm 2024.3.4 (Professional Edition)
Build #PY-243.25659.43, built on February 27, 2025
Runtime version: 21.0.6+8-b631.39 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.X11.XToolkit
Linux 6.13.8-200.fc41.x86_64
Fedora Linux 41 (Workstation Edition); glibc: 2.4
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 16
Registry:
ide.balloon.shadow.size=0
ide.new.editor.tabs.vertical.borders=true
ide.experimental.ui=true
ide.editor.tab.selection.animation=true
Non-Bundled Plugins:
cn.haojiyou.CodeGlance3 (2.1.1-2021.1.3)
net.sjrx.intellij.plugins.systemdunitfiles (242.250305.229)
com.tang (1.4.17-IDEA243)
com.redhat.devtools.lsp4ij (0.11.0)
String Manipulation (9.15.0)
dev.meanmail.plugin.nginx-intellij-plugin (2025.6)
com.bennycode.linessorterplus (1.2.0)
de.achimonline.ansible_lint (1.10.1)
com.intellij.ml.llm (243.23654.270.16)
pro.bashsupport (4.6.0.243)
com.taff.plugin.orchide (2024.1.2.0-2023.1)
com.mallowigi (101.2.0)
com.chrisrm.idea.MaterialThemeUI (9.7.0)
Current Desktop: KDE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions