btxml.fromJSON
Parse a BTXML script from a JSON string. The complete schema can be viewed here.
Syntax
system.bartender.btxml.fromJSON(json)
Parameters
Type | Parameter | Description |
---|---|---|
String | json | a JSON string of script parameters |
Returns
BTXMLScript - Parsed result.
Scope
Gateway, Designer, Client, Perspective Session
Example
Parse a BTXML script from a JSON string.
config = """{
"version": "2.0",
"commands": [
{
"type": "Print",
"actions": [{
"type": "Print",
"jobName": "Print Item Label",
"format": {
"documentPath": "C:/Path/To/File.btw"
},
"printSetup": {
"printer": "MyLabelPrinter"
},
"namedSubStrings": [
{
"name": "name",
"value": "Item Name"
},
{
"name": "quantity",
"value": "500"
}
]
}]
}
]
}"""
script = system.bartender.btxml.fromJSON(config)
print script.toBTXML()
Result
<XMLScript Version="2.0">
<Command Name="">
<Print JobName="Print Item Label">
<Format>C:/Path/To/File.btw</Format>
<NamedSubString Name="name">
<Value>Item Name</Value>
</NamedSubString>
<NamedSubString Name="quantity">
<Value>500</Value>
</NamedSubString>
<PrintSetup>
<Printer>MyLabelPrinter</Printer>
</PrintSetup>
</Print>
</Command>
</XMLScript>