[Java] Interface JsonGenerator
public interface JsonGenerator
Generates JSON from objects. The Options builder can be used to configure an instance of a JsonGenerator.
- See Also:
- Options#build()#build()
- Since:
- 2.5.0
Nested Class Summary
Modifiers | Name | Description |
---|---|---|
interface | JsonGenerator.Converter | Handles converting a given type. |
class | JsonGenerator.Options | A builder used to construct a JsonGenerator instance that allows control over the serialized JSON output. |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public boolean |
isExcludingFieldsNamed(String name) Indicates whether this JsonGenerator is configured to exclude fields by the given name. | |
public boolean |
isExcludingValues(Object value) Indicates whether this JsonGenerator is configured to exclude values of the given object (may be null ). | |
public String |
toJson(Object object) Converts an object to its JSON representation. |
Method Detail
public boolean isExcludingFieldsNamed(String name)
Indicates whether this JsonGenerator is configured to exclude fields by the given name.
- Parameters:
-
name
- of the field
- Returns:
- true if that field is being excluded, else false
public boolean isExcludingValues(Object value)
Indicates whether this JsonGenerator is configured to exclude values of the given object (may be null
).
- Parameters:
-
value
- an instance of an object
- Returns:
- true if values like this are being excluded, else false
public String toJson(Object object)
Converts an object to its JSON representation.
- Parameters:
-
object
- to convert to JSON
- Returns:
- JSON
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/groovy/json/JsonGenerator.html