Set the name of a new JSON object property. @param name JSON object property name @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
(String name)
| 318 | * @throws java.util.NoSuchElementException if serialization object stack is empty |
| 319 | */ |
| 320 | public JsonOutput name(String name) { |
| 321 | if (!(stack.getFirst() instanceof JsonObject)) { |
| 322 | throw new JsonException("Attempt to write name, but not writing a json object: " + name); |
| 323 | } |
| 324 | ((JsonObject) stack.getFirst()).name(name); |
| 325 | return this; |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * End the current JSON object. |