Java Runtime 3.0.1
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
alfa.rt.JsonCodec Class Reference

Public Member Functions

String toJsonString (AlfaObject alfaObject) throws IOException
 
String toJsonString (JsonCodecConfig jsonCfg, AlfaObject alfaObject) throws IOException
 
OutputStream exportObj (JsonCodecConfig jsonCodecConfig, AlfaObject alfaObject) throws IOException
 
void exportObj (JsonCodecConfig jsonCodecConfig, AlfaObject alfaObject, OutputStream os) throws IOException
 
String toFormattedJson (AlfaObject alfaObject) throws IOException
 
String toFormattedJson (JsonCodecConfig cc, AlfaObject alfaObject) throws IOException
 
DataConsumer jsonDataConsumer (JsonCodecConfig wc, JsonGenerator jGenerator, OutputStream stream)
 
DataSupplier jsonDataSupplier (JsonCodecConfig cc, JsonParser jParser)
 

Static Public Attributes

static JsonCodecConfig CfgMapAsArrayWithNoMeta
 

Detailed Description

The JsonCodec class contains utility methods that encode and decode Alfa objects to and from JSON.

Member Function Documentation

◆ exportObj()

OutputStream alfa.rt.JsonCodec.exportObj ( JsonCodecConfig jsonCodecConfig,
AlfaObject alfaObject ) throws IOException
inline

Write JSON representation of an Alfa object to an OutputStream

Parameters
jsonCodecConfigJSON conversion settings
alfaObjectThe Alfa object to convert
Returns
OutputStream containing JSON representation of Alfa object
Exceptions
IOException

◆ toFormattedJson()

String alfa.rt.JsonCodec.toFormattedJson ( AlfaObject alfaObject) throws IOException
inline

Construct a formatted JSON string representing the Alfa object

Parameters
alfaObjectThe Alfa object to convert
Returns
JSON pretty-printed object
Exceptions
IOException

◆ toJsonString() [1/2]

String alfa.rt.JsonCodec.toJsonString ( AlfaObject alfaObject) throws IOException
inline

Constructs a JSON representation of an Alfa object

Parameters
alfaObjectThe Alfa object to convert
Returns
JSON string representing the object
Exceptions
IOException

◆ toJsonString() [2/2]

String alfa.rt.JsonCodec.toJsonString ( JsonCodecConfig jsonCfg,
AlfaObject alfaObject ) throws IOException
inline

Constructs a JSON representation of an Alfa object

Parameters
jsonCfgUse this configuration for conversion
alfaObjectThe Alfa object to convert
Returns
JSON string representing the object
Exceptions
IOException

Member Data Documentation

◆ CfgMapAsArrayWithNoMeta

JsonCodecConfig alfa.rt.JsonCodec.CfgMapAsArrayWithNoMeta
static
Initial value:
= JsonCodecConfig.newBuilder().
setWriteTypeMode(JsonTypeWriteMode.NeverWriteType).
setWriteMapAsJsonObject(false).
build()

Configuration without $type or $key metadata, also ALFA maps are written as array with key and val fields


The documentation for this class was generated from the following file: