Skip to main content
Log in

Mojo struct

JSONDict

struct JSONDict[mut: Bool, //, origin: Origin[mut]]

Represents a JSON object as a dictionary of string keys to JSON values.

Parameters

  • mut (Bool): Whether the dictionary is mutable.
  • origin (Origin[mut]): The origin of the dictionary's memory.

Implemented traits

AnyType, Copyable, ExplicitlyCopyable, Movable, Representable, Stringable, UnknownDestructibility, Writable

Methods

write_to

write_to[W: Writer, //](self, mut writer: W)

Writes the JSON dictionary to the given writer in JSON object format.

Parameters:

  • W (Writer): The type of the writer.

Args:

  • writer (W): The writer to write to.

__str__

__str__(self) -> String

Returns a string representation of the JSON dictionary.

Returns:

A string containing the JSON object representation.

__repr__

__repr__(self) -> String

Returns a string representation of the JSON dictionary.

Returns:

A string containing the JSON object representation.