Generators¶
Using Generator instances to parse JSON schemas¶
The Generator class is used to parse conduit JSON schemas into a Node.
g = conduit.Generator("{test: {dtype: float64, value: 100.0}}",
"conduit_json")
n = conduit.Node()
g.walk(n)
print(n["test"])
print(n)
{
"test": 100.0
}
The Generator can also parse pure json. For leaf nodes: wide types such as int64, uint64, and float64 are inferred.
g = conduit.Generator("{test: 100.0}",
"json")
n = conduit.Node()
g.walk(n)
print(n["test"])
print(n)
100.0
{
"test": 100.0
}