Assessment reports>Initia>Threat Model>Module json.move

Module json.move

Function: empty

Creates a new empty JSON object.

Inputs

Full prototype: public fun empty(): JsonObject

Function: data

Gets a reference to the inner SimpleMap.

Inputs

Full prototype: public fun data(json_obj: &JsonObject): &SimpleMap<JsonIndex, JsonElem>

  • json_obj: &JsonObject

    • Validation: None, but it must be of the correct type.

    • Impact: The JSON object whose inner SimpleMap is returned as a reference.

Function: stringify

Computes the string representation of the passed-in JSON object.

Inputs

Full prototype: public fun stringify(json_obj: &JsonObject): String

  • json_obj: &JsonObject

    • Validation: None, but the object must be created through this module.

    • Impact: The object is converted into a string.

Function: parse

Turns a JSON-string representation into a JSON object.

Inputs

Full prototype: public fun parse(json_string: String): JsonObject

  • json_string: String

    • Validation: Validated while parsing.

    • Impact: The string that is converted into a JSON object.

Function: find

Finds the JsonIndex matching a string key in a JsonObject given a parent JsonIndex.

Inputs

Full prototype: public fun find(obj: &JsonObject, index: &JsonIndex, key: &String): JsonIndex

  • obj: &JsonObject

    • Validation: None, but the object must be created through this module.

    • Impact: The object on which the lookup is done.

  • index: &JsonIndex

    • Validation: None, but the lookup of this index must succeed, or it will result in a revert.

    • Impact: This is the parent key where the lookup is performed.

  • key: &String

    • Validation: None necessary.

    • Impact: The string key being looked up.

Zellic © 2024Back to top ↑