Tajson
No edit summary
Line 1: Line 1:
'''TaJson''' is a declarative approach to receive, send, transform and store json messages, with setup and maintenance environment done in minutes
'''TaJson''' is a declarative approach to receive, send, transform and store json messages, with setup and maintenance environment done in minutes
You can find the original introduction of TaJson here: https://blog.mdriven.net/introducing-mdriven-tajson/


==== Creating Json from objects ====
==== Creating Json from objects ====
Line 15: Line 17:
# Action CleanUpAction if found on root ViewModelClass will be called after the import is finished
# Action CleanUpAction if found on root ViewModelClass will be called after the import is finished
When using [[OCLOperators MergeTaJson|MergeTaJson]] and [[OCLOperators ApplyTaJson|ApplyTaJson]] they both return a string (large) with a log of the Merge/Apply -log.
When using [[OCLOperators MergeTaJson|MergeTaJson]] and [[OCLOperators ApplyTaJson|ApplyTaJson]] they both return a string (large) with a log of the Merge/Apply -log.
==== Extension implemented 201909 ====
When confronted with very large and deep json structures it may be a good idea to split the processing and object creation into multiple smaller parts.
Especially the resolve and set of single links may prove problematic to do for a large number of leaf nodes in a large structure.
To facilitate such splitting of large work into smaller pieces we now allow for a special attribute in TaJSon import (Merge and Apply), the special attribute is '''RawJSon''':string (case sensitive).
When the logic finds a ViewModelColumn named RawJSon in a ViewModel nesting - the current Json text is inserted as a string - this is the JSon for the current level and below.
Example:
Consider this Json:


Read more on usage in [[Rest Services In MDriven]]
Read more on usage in [[Rest Services In MDriven]]

Revision as of 19:50, 9 September 2019

TaJson is a declarative approach to receive, send, transform and store json messages, with setup and maintenance environment done in minutes

You can find the original introduction of TaJson here: https://blog.mdriven.net/introducing-mdriven-tajson/

Creating Json from objects

Easiest is to use AsTaJson to create a Json object graph using a viewmodel as a template.

Creating objectsfrom Json

Given a Json object iterates attributes and associations - matching names in a VMClass-instance, and updates internal hierarchy of VMClass given first attribute as key

The RootObject must be given to the VMClass, after that the json object updates hierachy below.

To facilitate update we look for special things in the ViewModel:

  1. Action ViewModelColumn_AddNew will be used to create new objects needed for viewmodel-association with name ViewModelColumn - Action must return created object - if action is not found we will look at type info and create object. Note! the AddNew action MUST add the object to the association.
  2. Action Delete in nesting will be used if found when we need to delete object due to missing in input and merge mode is not in effect
  3. Variable vImportKey:string if found will be updated prior to creating a object - can be used in the _AddNew action to look up existing object
  4. Action CleanUpAction if found on root ViewModelClass will be called after the import is finished

When using MergeTaJson and ApplyTaJson they both return a string (large) with a log of the Merge/Apply -log.

Extension implemented 201909

When confronted with very large and deep json structures it may be a good idea to split the processing and object creation into multiple smaller parts.

Especially the resolve and set of single links may prove problematic to do for a large number of leaf nodes in a large structure.

To facilitate such splitting of large work into smaller pieces we now allow for a special attribute in TaJSon import (Merge and Apply), the special attribute is RawJSon:string (case sensitive).

When the logic finds a ViewModelColumn named RawJSon in a ViewModel nesting - the current Json text is inserted as a string - this is the JSon for the current level and below.

Example:

Consider this Json:

Read more on usage in Rest Services In MDriven

This page was edited 53 days ago on 03/26/2024. What links here