PsiElement (@NotNull JsonObject object, @NotNull JsonProperty property, boolean first) { final List<JsonProperty> propertyList = object.getPropertyList(); if (!first) { final JsonProperty lastProperty = ContainerUtil.getLastItem(propertyList); if (lastProperty != null) { final PsiElement addedProperty = object.addAfter(property, lastProperty); object.addBefore(new JsonElementGenerator(object.getProject()).createComma(), addedProperty); return addedProperty; } } final PsiElement leftBrace = object.getFirstChild(); assert hasElementType(leftBrace, JsonElementTypes.L_CURLY); final PsiElement addedProperty = object.addAfter(property, leftBrace); if (!propertyList.isEmpty()) { object.addAfter(new JsonElementGenerator(object.getProject()).createComma(), addedProperty); } return addedProperty; }