DataStoreExtensions.ExportJson(bool format = false) Method
.NET Standard 2.x
Exports data from the DataStore primary buffer to a plain JSON string or DataWindow JSON string.
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public static string ExportJson(this IDataStoreBase dataStore, bool format = false)
Parameters
format
System.Boolean
A boolean specifying the JSON format.
True
indicates the DataWindow JSON.
False
(default) indicates the plain JSON.
Returns
System.String
Returns the JSON string if it succeeds.
Examples
The following code example exports the data from the primary buffer of DataStore to a plain JSON string.
using System;
using DWNet.Data;
using PowerScript.Bridge;
namespace Appeon.ApiDoc.DataStoreExtensionsExamples
{
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);
datastore.Retrieve();
// Exports to a plain JSON string.
string json = datastore.ExportJson(false);
Console.WriteLine(json);
/*The exported JSON file is:
ExportJson1.json
*/
}
}
}
Example Refer To
Model Class: D_Department
JSON File: ExportJson1
DataWindow File: d_department
Applies to
.NET Standard
2.x