Home > other >  Unable to paste multi-line JSON string into environment variable in Eclipse run configurations
Unable to paste multi-line JSON string into environment variable in Eclipse run configurations

Time:08-03

I am trying to set a multi-line JSON string in environment variable under Run Configurations in eclipse IDE. However, it takes just the first line and discards all. For example, let's say I have a below JSON:

{"name":"apple",
"type":"fruit"}

When I am attempting to post the JSON into the environment variable, its just taking the first line alone as depicted below:

{"name":"apple",

However, it works absolutely fine in IntelliJ IDE.

CodePudding user response:

The run/launch configuration dialog does not support entering a multi-line string for an environment variable.

As workaround you can encode line breaks as ${system_property:line.separator}, e.g. for your example:

{"name":"apple",${system_property:line.separator}"type":"fruit"}

You can do the replacing in an Untitled Text File via Find and Replace (Ctrl F) by replacing \R with \${system_property:line.separator} as Regular Expression.

CodePudding user response:

It doesn't discard anything. Press OK as if it hasn't, because when you try to edit the value later, it'll all be there.

  • Related