DataStoreDataExtensions.ExportJson(this IDataStoreBase dataStore, MappingMethod mappingMethod) Method
.NET Standard 2.x
Exports data from the DataStore primary buffer to a DataWindow JSON string.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
  public static string ExportJson(this IDataStoreBase dataStore, MappingMethod mappingMethod);
Parameters
mappingMethod SnapObjects.Data.MappingMethod
A value of the MappingMethod enumerated datatype specifying the method for mapping columns.
MappingMethod.Index-- Use the index of JSON item to map with the DataStore column. The "mapping-method" value in the exported JSON string is 0.MappingMethod.ColumnIndex-- Use the index of meta-columns to map with the DataStore column. The "mapping-method" value in the exported JSON string is 1.MappingMethod.Key-- Use the key of JSON item to map with the DataStore column. The "mapping-method" value in the exported JSON string is 2.
Returns
System.String
Returns the JSON string.
Examples
The following code example demonstrates how to export the department records to a JSON string using different mapping methods.
using SnapObjects.Data;
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.DataStoreDataExtensionsExamples
{
    public class ExportJsonExample
    {
        private readonly SchoolContext _context;
        public ExportJsonExample(SchoolContext dataContext)
        {
            // Sets the data context
            _context = dataContext;
        }
        public void Example1()
        {
            // Instantiates a DataStore object with datawindow: d_department.
            var datastore = new DataStore("d_department", _context);
            // Generates data in primary/delete/filter buffers for this example
            datastore.Retrieve();
            datastore.DeleteRow(0);
            datastore.SetFilter("departmentid < 5");
            datastore.Filter();
            // Exports data from primary buffer to JSON string
            // mapped by the JSON index
            // mapping-method value in JSON is 0
            string json1 = datastore.ExportJson(MappingMethod.Index);
            Console.WriteLine(json1);
            /*The exported JSON file is:
            ExportJson1_Index.json
            */
            // Exports data from primary buffer to JSON string 
            // mapped by the JSON key 
            // mapping-method value in JSON is 2 
            string json2 = datastore.ExportJson(MappingMethod.Key);
            Console.WriteLine(json2);
            /*The exported JSON file is:
            ExportJson1_Key.json
            */
            // Exports data from primary buffer to JSON string 
            // mapped by the column index 
            // mapping-method value in JSON is 1 
            string json3 = datastore.ExportJson(MappingMethod.ColumnIndex);
            Console.WriteLine(json3);
            /*The exported JSON file is:
            ExportJson1_ColumnIndex.json
            */
        }
    }
}
Example Refer To
Model Class: D_Department 
JSON Files: ExportJson1_Index ExportJson1_Key ExportJson1_ColumnIndex 
DataWindow File: d_department 
Applies to
.NET Standard
2.x