Alex Ts
Alex Ts

Reputation: 33

Enabling multi-line support for JSON file in IntelliJ IDEA

I'm using Jackson library to parse my JSON and map it to Java model class. On top of that, I'm using 2 custom parsing options:

so my code looks like this:

public static void setClassProperties(Object target, String jsonObjectString) 
{
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
    mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
    ...

However, after wast amount of time spent on googling I didn't find any way that I can enable these options in IntelliJ IDEA JSON editor - in the way so it doesn't show errors when I insert multi-line value:

{
      "Type": "CommandTask",
      "Description": "Run my script",
      "Executable": "Powershell",
      "Argument": "-file .\\MyScript.ps1
                            -Argument1 ${Argument1}
                            -Argument2 ${Argument2}
                            -Argument3 ${Argument3}"

},

Does anybody know how to enable Jackson JSON editor support for IntelliJ IDEA or at the very least to enable multi-line support?

Upvotes: 1

Views: 3229

Answers (1)

lena
lena

Reputation: 93758

To get comments accepted, you can clear Warn about comments checkbox in Settings | Editor | Inspections, JSON | Compliance with JSON standard. But there is no way to get rid of errors on multiline unquoted strings - this is the invalid syntax not accepted by JS/JSON parser

Upvotes: 1

Related Questions