JsonCodec

com.digitalasset.transcode.codec.json.JsonCodec
class JsonCodec(encodeNumericAsString: Boolean, encodeInt64AsString: Boolean, allowMissingFields: Boolean, removeTrailingNonesInRecords: Boolean) extends CodecVisitor[Value]

Json Codec.

Value parameters

allowMissingFields

allow missing fields in records or throw, Canton uses this for testing only

encodeInt64AsString

encode int64 as a string (true) or as a json number (false). The latter might be useful for querying and mathematical operations, but can lose precision, as numbers in some json implementations are backed Double.

encodeNumericAsString

encode numeric as string (true) or as a json number (false). The latter might be useful for querying and mathematical operations, but can lose precision due to float point errors.

removeTrailingNonesInRecords

if true, trailing nones are removed from the record values

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited types

final type Result = Dictionary[Codec[Value]]

Final result type

Final result type

Attributes

Inherited from:
WithResult
final type Type = Codec[Value]

Visitor handler type for various DAML schema cases.

Visitor handler type for various DAML schema cases.

Attributes

Inherited from:
CodecVisitor

Value members

Concrete methods

override def bool: Type

Boolean

Boolean

Attributes

Definition Classes
override def contractId(template: Type): Type

Contract ID, parametrized with the processor for corresponding template

Contract ID, parametrized with the processor for corresponding template

Attributes

Definition Classes
override def date: Type

Date

Date

Attributes

Definition Classes
override def enumeration(cases: Seq[EnumConName]): Type

ADT, Sum type - special case, where there are only named constructors without arguments

ADT, Sum type - special case, where there are only named constructors without arguments

Attributes

Definition Classes
override def genMap(key: Type, value: Type): Type

Map with keys and values of any type

Map with keys and values of any type

Attributes

Definition Classes
override def int64: Type

8-byte Integer

8-byte Integer

Attributes

Definition Classes
override def list(elem: Type): Type

Sequence of elements

Sequence of elements

Attributes

Definition Classes
override def numeric(scale: Int): Type

Numeric with scale

Numeric with scale

Attributes

Definition Classes
override def optional(elem: Type): Type

Optional element

Optional element

Attributes

Definition Classes
override def party: Type

Party

Party

Attributes

Definition Classes
override def record(fields: Seq[(FieldName, Type)]): Type

ADT, Product type

ADT, Product type

Attributes

Definition Classes
override def text: Type

Text

Text

Attributes

Definition Classes
override def textMap(value: Type): Type

Map with keys of String/Text type

Map with keys of String/Text type

Attributes

Definition Classes
override def timestamp: Type

Timestamp

Timestamp

Attributes

Definition Classes
override def unit: Type

Unit

Unit

Attributes

Definition Classes
override def variant(cases: Seq[(VariantConName, Type)]): Type

ADT, Sum type

ADT, Sum type

Attributes

Definition Classes

Inherited methods

Type Application

Type Application

Attributes

Definition Classes
Inherited from:
CodecVisitor
final override def collect(entities: Seq[Template[Type]]): Result

Attributes

Definition Classes
Inherited from:
CodecVisitor
final override def constructor(id: Identifier, typeParams: Seq[TypeVarName], value: => Type): Type

Wrap type into addressable DataType

Wrap type into addressable DataType

Attributes

Definition Classes
Inherited from:
CodecVisitor
final override def unknown(id: Identifier, args: Seq[Type]): Type

Unknown Type. A template can reference ContractId U where U is unknown because non-serializable. This type cannot be used for decoding payloads.

Unknown Type. A template can reference ContractId U where U is unknown because non-serializable. This type cannot be used for decoding payloads.

Value parameters

args

The type arguments or empty if id is not a type constructor. This cannot be modeled as an application because the type param names are unknown.

id

The type or type constructor identifier

Attributes

Definition Classes
Inherited from:
CodecVisitor
final override def variable(name: TypeVarName): Type

Type Variable.

Type Variable.

Codecs will use substitution, effectively replacing type variables with concrete types, while code generators will use type variable names.

Attributes

Definition Classes
Inherited from:
CodecVisitor

Extensions

Inherited extensions

extension [A](array: Array[A])
inline def getMaybe(ix: Int): A

Attributes

Inherited from:
CodecVisitor
extension [K, V](map: Map[K, V])
inline def getMaybe(key: K): V

Attributes

Inherited from:
CodecVisitor