Please enable JavaScript to view this site.

Take Command / TCC Help v. 28

@JSONCREATE[filename] : Create a JSON file for writing by other JSON variable functions (for example, @JSONSTARTOBJECT, @JSONPUTPROPERTY, etc.).

 

If a JSON file is already open it will be closed before the new file is created. If the file already exists, @JSONCREATE will return an error.

 

Returns 0 on success, or a JSON error code on failure.

 

Example:

 

This batch file creates a JSON file named d:\fido.json, writes the opening brace, writes a property, writes the closing brace, and closes the file:

 

echo %@jsoncreate[d:\fido.json]

echo %@jsonStartObject[]

echo %@jsonPutProperty["name", "fido", 2]

echo %@jsonEndObject[]

echo %@jsonFlush[]

echo %@jsonclose[]

 

The resulting file d:\json looks like this:

 

{"name":"fido"}

JSON Errors

10231   Unbalanced element tag

10232   Invalid JSON markup

10233   Invalid XPath

10234   DOM tree unavailable

XMLp Errors

101   Invalid attribute index

102   No attributes available

103   Invalid namespace index

104   No namespaces available

105   Invalid element index

106   No elements available

107   Attribute does not exist

201   Unbalanced element tag

202   Unknown element prefix (can't find namespace)

203   Unknown attribute prefix (can't find namespace)

204   Invalid XML markup

205   Invalid end state for parser

206   Document contains unbalanced element

207   Invalid XPath

208   No such child

209   Top element does not match start of path

210   DOM tree unavailable

302   Can't open file.