Code Block |
---|
|
set myAddress = addressAsJSONDocument.jsonToClass(); |
The action script below creates an object of type Address. An output object flow state named myAddress of type Address needs to be defined in the activity diagram.
Code Block |
---|
|
create myAddress;
set myAddress = addressAsJSONDocument.jsonToClass(); |
Below, a sample JSON string is shown to illustrate the mapping executed by the jsonlToClass() operation. The JSON string is mapped to an instance of Address as shown in the activity diagram.
Code Block |
---|
|
{"name":"John Snow", "street":"99, Malamute Street"} |
Image Modified Image Modified | Image Modified |
Find below a second example, showing how to specify the Bridge type at runtime, e.g. if using a derived class.
Code Block |
---|
|
{
"e2e:type":"urn:json.e2e.ch.AddressWithMail",
"name":"John Snow",
"street":"99, Malamute Street",
"mailaddress":"john.snow@winter.com"
} |
The Bridge type is declared by the attribute "e2e:type
". The type has to be specified like <xml_namespace>.<classname>