Enum quickxml_to_serde::JsonType
source · pub enum JsonType {
AlwaysString,
Bool(Vec<&'static str>),
Infer,
}
Expand description
Defines which data type to apply in JSON format for consistency of output.
E.g., the range of XML values for the same node type may be 1234
, 001234
, AB1234
.
It is impossible to guess with 100% consistency which data type to apply without seeing
the entire range of values. Use this enum to tell the converter which data type should
be applied.
Variants§
AlwaysString
Do not try to infer the type and convert the value to JSON string.
E.g. convert <a>1234</a>
into {"a":"1234"}
or <a>true</a>
into {"a":"true"}
Bool(Vec<&'static str>)
Convert values included in this member into JSON bool true
and any other value into false
.
E.g. Bool(vec!["True", "true", "TRUE"]) will result in any of these values to become JSON bool
true`.
Infer
Attempt to infer the type by looking at the single value of the node being converted.
Not guaranteed to be consistent across multiple nodes.
E.g. convert <a>1234</a>
and <a>001234</a>
into {"a":1234}
, or <a>true</a>
into {"a":true}
Check if your values comply with JSON data types (case, range, format) to produce the expected result.