}
@Override
public JsonGenerator writeEnd() {
if (currentContext.scope == Scope.IN_NONE) {
throw new JsonGenerationException("writeEnd() cannot be called in no context");
}
writeChar(currentContext.scope == Scope.IN_ARRAY ? ']' : '}');
currentContext = stack.pop();
return this;
}