Function syn_serde::json::to_string

source ·
pub fn to_string<S>(syn: &S) -> String
where S: Syn,
Available on crate feature json only.
Expand description

Serialize the given Syn type as a String of JSON.

This function is equivalent to the following code:

use syn_serde::Syn;

let adapter = syn_file.to_adapter();
serde_json::to_string(&adapter).unwrap()