scalapb.ujson

Members list

Concise view

Type members

Classlikes

object JsonFormat extends JsonFormat

The default instance.

The default instance.

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
class JsonFormat(val preserveProtoFieldNames: Boolean, val includeDefaultValueFields: Boolean, val formatEnumsAsNumbers: Boolean)

Utility for writing and reading ScalaPB-generated messages to and from JSON via the ujson library.

Utility for writing and reading ScalaPB-generated messages to and from JSON via the ujson library.

This utility is designed around ujson's visitors. This means that intermediate data structures are avoided as much as reasonably possible, and therefore memory usage is kept low and performance should be very good for conversions. For example, if you write a ScalaPB message to a JSON string, the message will be transformed into a string directly, without passing through an intermediate JSON tree structure. Or, if you write a message to a stream, the message is written on demand and no full JSON string needs to be generated beforehand.

Attributes

formatEnumsAsNumbers

Default false. Use enum values' numbers instead of their names.

includeDefaultValueFields

Default false. If set, then fields of messages are always included in JSON, even if they correspond to the default protobuf value.

preserveProtoFieldNames

Default true. If set, then the field names of protobuf messages are used as-is (this means usually snake_case). Otherwise, they are converted to camelCase.

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object JsonFormat.type
class JsonFormatException(msg: String, cause: Throwable) extends Exception

Attributes

Graph
Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Known subtypes

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
class JsonReadException(val message: String, val position: Int, cause: Throwable) extends JsonFormatException

Attributes

Graph
Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
object KeyVisitor extends SimpleVisitor[_, String]

Attributes

Graph
Supertypes
trait SimpleVisitor[_, String]
trait Visitor[Nothing, String]
class Object
trait Matchable
class Any
Self type
object NoOpVisitor extends Visitor[PValue, PValue]

Attributes

Graph
Supertypes
trait Visitor[PValue, PValue]
class Object
trait Matchable
class Any
Self type
class Reader(md: Descriptor) extends SimpleVisitor[PValue, PMessage]

Attributes

Graph
Supertypes
trait SimpleVisitor[PValue, PMessage]
trait Visitor[PValue, PMessage]
class Object
trait Matchable
class Any
trait SimpleVisitor[-T, +V] extends Visitor[T, V]

Attributes

Graph
Supertypes
trait Visitor[T, V]
class Object
trait Matchable
class Any
Known subtypes
object KeyVisitor.type
class Reader
object TimeUtils

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type