🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
Using JSON or XML as class template

Using JSON or XML as a class template

You can use an existing JSON or XML snippet as a template to create a model section you can import into.

Using the default model and the Class detail, have the following JSON snippet in the clipboard:

 <root>
  <person id='1'>
    <name>Alan</name>
    <url>http://www.google.com</url>
  </person>
  <person id='2'>
    <name>Louis</name>
    <url>http://www.yahoo.com</url>
  </person>
 </root>

Right-click the class you want to use as a root for your import (using, for example, Tajson,) and select "Add attributes, assoc. and classes from clipboard json or xml" - see below:

This will add the Root1 and Person1 classes to your model like this:

After this, you can use JSonToObjects or Tajson to create objects from your JSON or XML.