Navision-JSON modeling
Let's simulate a simplified NAV database definition consisting of two records.
Each record contains a table of data related to other tables as shown on the following figures.
In this schema, the value of any table field is uniquely determined by the following key:
- Table ID
- Field ID
- Parent Table ID
- Parent Field ID
- Record ID
To tables and fields have been assigned conventional names.
The following classes have been created in C # Console application:
public class NavRecordSet...public class NavRecord...public class NavTable...public class NavField...
After calling the WriteRecordSet() function, the following printout of the structure follows:
And finally, by following lines of code:
NavRecordSet rs = new NavRecordSet();
int NoOfRecors = 2;
rs.CreateRecordSet(NoOfRecors);
string json = JsonConvert.SerializeObject(rs,Formatting.Indented);Console.Write(json);
we get JSON string (fragments):
The following tasks are: give values to the fields and export \ import Json files.