Module json

Source
Expand description

Implementations of Json cheatcodes.

Functions§

canonicalize_json_path 🔒
Canonicalize a json path key to always start from the root of the document. Read more about json path syntax: https://goessner.net/articles/JsonPath/
check_json_key_exists 🔒
encode 🔒
json_to_sol 🔒
json_value_to_token 🔒
Converts a JSON Value to a [DynSolValue] by trying to guess encoded type. For safer decoding, use parse_json_as.
parse_json 🔒
parse_json_array 🔒
parse_json_as 🔒
Parses given serde_json::Value as a [DynSolValue].
parse_json_coerce 🔒
parse_json_keys 🔒
parse_json_map 🔒
parse_json_str 🔒
resolve_type 🔒
Resolves a [DynSolType] from user input.
select 🔒
serialize_json 🔒
Serializes a key:value pair to a specific object. If the key is valueKey, the value is expected to be an object, which will be set as the root object for the provided object key, overriding the whole root object if the object key already exists. By calling this function multiple times, the user can serialize multiple KV pairs to the same object. The value can be of any type, even a new object in itself. The function will return a stringified version of the object, so that the user can use that as a value to a new invocation of the same function with a new object key. This enables the user to reuse the same function to crate arbitrarily complex object structures (JSON).
serialize_value_as_json 🔒
Serializes given [DynSolValue] into a serde_json::Value.