End the current JSON object. @return this JsonOutput object @throws JsonException if top item on serialization object stack isn't a JsonObject @throws java.util.NoSuchElementException if serialization object stack is empty
()
| 322 | * @throws java.util.NoSuchElementException if serialization object stack is empty |
| 323 | */ |
| 324 | public JsonOutput endObject() { |
| 325 | Node topOfStack = stack.getFirst(); |
| 326 | if (!(topOfStack instanceof JsonObject)) { |
| 327 | throw new JsonException("Attempt to close a json object, but not writing a json object"); |
| 328 | } |
| 329 | stack.removeFirst(); |
| 330 | indent = indent.substring(0, indent.length() - indentBy.length()); |
| 331 | |
| 332 | if (topOfStack.isEmpty) { |
| 333 | appender.accept(indent + "}"); |
| 334 | } else { |
| 335 | appender.accept(lineSeparator + indent + "}"); |
| 336 | } |
| 337 | return this; |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Begin a new JSON array. |
no test coverage detected