Skip to main content

json

Attribute Macro json 

Source
#[json]
Expand description

Attribute macro for specifying JSON serialization format.

Use this to override the contract-level serialization format for a specific method.

§Examples

#[near_kit::contract(borsh)]  // Contract default: Borsh
pub trait MyContract {
    #[json]  // Override: this method uses JSON
    fn get_json_data(&self) -> JsonData;
}