Java Runtime 3.0.1
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
com.schemarise.alfa.runtime.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 com.schemarise.alfa.runtime.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 com.schemarise.alfa.runtime.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 com.schemarise.alfa.runtime.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 com.schemarise.alfa.runtime.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 com.schemarise.alfa.runtime.JsonCodec.CfgMapAsArrayWithNoMeta
static
Initial value:
= JsonCodecConfig.builder().
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: