Copyright [2019] [Syntea software group a.s.]

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

# Version 32.5.0, release-date 2019-07-11
– Prepared the EXPERIMENTAL version for processing JSON data (it does not
influence the processing of XML data).
The X-component has the new method toJson which returns a JCON object.
It is also now available the new class org.xdef.json.JsonUtil which
enables to work with JSON objects (conversion JSON to XML, XML to JSON,
parse source JSON data, compare JSON objects).
In the X-definition is now possible to specify a JSON model written to
an element js:json as a text child. The namespace assigned to the prefix
“js” can be either: (see XDConstants.JSON_NS_URI)
used for X-definition version of JSON to XML coversion
or (see XDConstants.JSON_NS_URI_W3C)
used for W3C version of conversion to XML
In the class XDDocument are now implemented the methods “jparse” (parsing
of an JSON objects with X-definition).
<xd:def xmlns:xd=”″
xd:name=”Test” xd:root=”js:json”>
“Name”: “jstring(1, 50); onFalse outln(‘Incorrect name’)”,
“Salary”: “int(1000, 1000000)”,
“Vehicle”: “optional enum(‘Skoda’,’Ford’,’WW’,’Other’);”
JSON data:
{ “Name”: “John Smith”, “Salary”: 3500, “Vehicle”: “Ford” }
Program in Java:
File json; // file with JSON data
File xdef; // file with X-definition
XDPool xp = XDFactory.compileXD(null, xdef); // compile X-definition
XDDocument xd = xp.createXDDocument(“test”);
// parse json source and return parsed JSON object
Object result = xd.jparse(json, “js:json”, null);
// result will be the instance of java.util.Map