Skip to main content
Log in

Mojo struct

JSONList

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

Represents a JSON array as a list of JSON values.

Parameters

  • mut (Bool): Whether the list is mutable.
  • origin (Origin[mut]): The origin of the list'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 list to the given writer in JSON array 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 list.

Returns:

A string containing the JSON array representation.

__repr__

__repr__(self) -> String

Returns a string representation of the JSON list.

Returns:

A string containing the JSON array representation.