package com.intellij.json.formatter;

import com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesHandler;

/**
 * @author Mikhail Golubev
 */
public class JsonEnterBetweenBracesHandler extends EnterBetweenBracesHandler {
  @Override
  protected boolean isBracePair(char c1, char c2) {
    return (c1 == '{' && c2 == '}') || (c1 == '[' && c2 == ']');
  }
}

@@ -114,122 +114,1044 @@
 er;%0A
-%0A/**%0A * @author Mikhail Golubev%0A */%0Apublic class JsonEnterBetweenBracesHandler extends EnterBetweenBracesHandler %7B
+import com.intellij.json.JsonLanguage;%0Aimport com.intellij.openapi.actionSystem.DataContext;%0Aimport com.intellij.openapi.editor.Editor;%0Aimport com.intellij.openapi.editor.actionSystem.EditorActionHandler;%0Aimport com.intellij.openapi.util.Ref;%0Aimport com.intellij.psi.PsiFile;%0Aimport org.jetbrains.annotations.NotNull;%0A%0A/**%0A * @author Mikhail Golubev%0A */%0Apublic class JsonEnterBetweenBracesHandler extends EnterBetweenBracesHandler %7B%0A  @Override%0A  public Result preprocessEnter(@NotNull PsiFile file,%0A                                @NotNull Editor editor,%0A                                @NotNull Ref%3CInteger%3E caretOffsetRef,%0A                                @NotNull Ref%3CInteger%3E caretAdvance,%0A                                @NotNull DataContext dataContext,%0A                                EditorActionHandler originalHandler) %7B%0A    if (!file.getLanguage().is(JsonLanguage.INSTANCE)) %7B%0A      return Result.Continue;%0A    %7D%0A    return super.preprocessEnter(file, editor, caretOffsetRef, caretAdvance, dataContext, originalHandler);%0A  %7D%0A
 %0A  @

Check language in JsonEnterBetweenBracesHandler