End the current JSON array. @return this JsonOutput object @throws JsonException if top item on serialization object stack isn't a JsonCollection @throws java.util.NoSuchElementException if serialization object stack is empty
()
| 370 | * @throws java.util.NoSuchElementException if serialization object stack is empty |
| 371 | */ |
| 372 | public JsonOutput endArray() { |
| 373 | Node topOfStack = stack.getFirst(); |
| 374 | if (!(topOfStack instanceof JsonCollection)) { |
| 375 | throw new JsonException("Attempt to close a json array, but not writing a json array"); |
| 376 | } |
| 377 | stack.removeFirst(); |
| 378 | indent = indent.substring(0, indent.length() - indentBy.length()); |
| 379 | |
| 380 | if (!topOfStack.isEmpty) { |
| 381 | rawAppend(lineSeparator); |
| 382 | rawAppend(indent); |
| 383 | } else { |
| 384 | rawAppend(indent); |
| 385 | } |
| 386 | rawAppend("]"); |
| 387 | return this; |
| 388 | } |
| 389 | |
| 390 | /** |
| 391 | * Serialize the specified Java object as a JSON value.<br> |
no test coverage detected