ocpp/json_value

A transport-neutral representation of an arbitrary JSON value.

Some OCPP fields (e.g. DataTransfer.data) carry data of no fixed schema. Rather than couple the message types to gleam_json, such fields use this recursive value type; the JSON codec for it lives in ocpp/transport/json/codec.

Note: decoding a JsonObject goes through a dict, so object key order is not preserved on a round trip (the value is semantically equal). Array order and all scalars are preserved.

Types

pub type JsonValue {
  JsonNull
  JsonBool(Bool)
  JsonInt(Int)
  JsonFloat(Float)
  JsonString(String)
  JsonArray(List(JsonValue))
  JsonObject(List(#(String, JsonValue)))
}

Constructors

  • JsonNull
  • JsonBool(Bool)
  • JsonInt(Int)
  • JsonFloat(Float)
  • JsonString(String)
  • JsonArray(List(JsonValue))
  • JsonObject(List(#(String, JsonValue)))
Search Document