Type Alias ResponseFormatJsonObject

Source
pub type ResponseFormatJsonObject = Value;
Expand description

§on openapi.yaml

ResponseFormatJsonObject:
  type: object
  title: JSON object
  description: >
    JSON object response format. An older method of generating JSON
    responses.

    Using `json_schema` is recommended for models that support it. Note that
    the

    model will not generate JSON without a system or user message
    instructing it

    to do so.
  properties:
    type:
      type: string
      description: The type of response format being defined. Always `json_object`.
      enum:
        - json_object
      x-stainless-const: true
  required:
    - type

Aliased Type§

pub enum ResponseFormatJsonObject {
    Null,
    Bool(bool),
    Number(Number),
    String(String),
    Array(Vec<Value>),
    Object(Map<String, Value>),
}

Variants§

§

Null

Represents a JSON null value.

let v = json!(null);
§

Bool(bool)

Represents a JSON boolean.

let v = json!(true);
§

Number(Number)

Represents a JSON number, whether integer or floating point.

let v = json!(12.5);
§

String(String)

Represents a JSON string.

let v = json!("a string");
§

Array(Vec<Value>)

Represents a JSON array.

let v = json!(["an", "array"]);
§

Object(Map<String, Value>)

Represents a JSON object.

By default the map is backed by a BTreeMap. Enable the preserve_order feature of serde_json to use IndexMap instead, which preserves entries in the order they are inserted into the map. In particular, this allows JSON data to be deserialized into a Value and serialized to a string while retaining the order of map keys in the input.

let v = json!({ "an": "object" });