json_serialization/types

Source   Edit  

Types

JsonError = object of SerializationError
Source   Edit  
JsonNumber[T] = object
  sign*: JsonSign
  integer*: T
  fraction*: string
  expSign*: JsonSign
  exponent*: T
Source   Edit  
JsonObjectType[T] = OrderedTable[string, JsonValueRef[T]]
Source   Edit  
JsonReaderConf = object
  nestedDepthLimit*: int
  arrayElementsLimit*: int
  objectMembersLimit*: int
  integerDigitsLimit*: int
  fractionDigitsLimit*: int
  exponentDigitsLimit*: int
  stringLengthLimit*: int
Source   Edit  
JsonReaderFlag {.pure.} = enum
  allowUnknownFields, requireAllFields, escapeHex, relaxedEscape, portableInt,
  trailingComma, allowComments, leadingFraction, integerPositiveSign
Source   Edit  
JsonSign {.pure.} = enum
  None, Pos, Neg
Source   Edit  
JsonString = distinct string
A string containing valid JSON. Used to preserve and pass on parts of a JSON document to another parser or layer without interpreting it further Source   Edit  
JsonValue[T] = object
  case kind*: JsonValueKind
  of JsonValueKind.String:
    strVal*: string
  of JsonValueKind.Number:
    numVal*: JsonNumber[T]
  of JsonValueKind.Object:
    objVal*: JsonObjectType[T]
  of JsonValueKind.Array:
    arrayVal*: seq[JsonValueRef[T]]
  of JsonValueKind.Bool:
    boolVal*: bool
  of JsonValueKind.Null:
    nil
Source   Edit  
JsonValueKind {.pure.} = enum
  String, Number, Object, Array, Bool, Null
Source   Edit  
JsonValueRef[T] = ref JsonValue[T]
Source   Edit  
JsonVoid = object
Marker used for skipping a JSON value during parsing Source   Edit  

Consts

defaultJsonReaderConf = (nestedDepthLimit: 512, arrayElementsLimit: 0,
                         objectMembersLimit: 0, integerDigitsLimit: 128,
                         fractionDigitsLimit: 128, exponentDigitsLimit: 32,
                         stringLengthLimit: 0)
Source   Edit  
defaultJsonReaderFlags = {JsonReaderFlag.integerPositiveSign,
                          JsonReaderFlag.allowComments,
                          JsonReaderFlag.leadingFraction,
                          JsonReaderFlag.trailingComma}
Source   Edit  
maxPortableInt = 9007199254740991'i64
Source   Edit  
minPortableInt = -9007199254740991'i64
Source   Edit  

Procs

func `==`(lhs, rhs: JsonValueRef): bool {....raises: [], gcsafe.}
Source   Edit  
func hasExponent[T](x: JsonNumber[T]): bool {....raises: [], gcsafe.}
Source   Edit  
func isFloat(x: JsonNumber): bool {....raises: [], gcsafe.}
Source   Edit  
func toInt(sign: JsonSign): int {....raises: [], gcsafe, tags: [], forbids: [].}
Source   Edit  

Templates

template `$`(s: JsonString): string {..}
Source   Edit  
template `==`(lhs, rhs: JsonString): bool {..}
Source   Edit  
template valueType[K, V](_: type OrderedTable[K, V]): untyped {..}
Source   Edit