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)
| 307 | * @throws java.util.NoSuchElementException if serialization object stack is empty |
| 308 | */ |
| 309 | public JsonOutput name(String name) { |
| 310 | if (!(stack.getFirst() instanceof JsonObject)) { |
| 311 | throw new JsonException("Attempt to write name, but not writing a json object: " + name); |
| 312 | } |
| 313 | ((JsonObject) stack.getFirst()).name(name); |
| 314 | return this; |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * End the current JSON object. |
no test coverage detected