SharePoint Online Connector
Documentation
Version: 17
Documentation

Table FileReaderWriterJson


Parameters

Parameter Label Required Options Description Help
There are no parameters

Supported Operations

Below section contains supported CRUD operations. Each operation is executed by some EndPoint behind the scene.
Method Supported Reference EndPoint
SELECT get_json_file
INSERT create_json_file
UPDATE create_json_file
UPSERT
DELETE
LOOKUP

Examples

SSIS

Use SharePoint Online Connector in API Source component to read data or in API Destination component to read/write data:

Read from JSON File Read/Write table using API Source

SharePoint Online
JSON File Read/Write
SSIS API Source - Read from table or endpoint

Read/write to JSON File Read/Write table using API Destination

SharePoint Online
JSON File Read/Write
Select
SSIS API Destination - Access table operation

ODBC application

Use these SQL queries in your ODBC application data source:

Create / Update a JSON File in SharePoint Document Library from External Data Source (e.g. MSSQL / ODBC)

This example shows how to create / update a JSON file directly inside SharePoint Document Library using streaming approach. This example reads records from Microsoft SQL Server database and writes data to JSON file on SharePoint Document Library. If file does not exists then it creates a new one. It uses LayoutMap to generate JSON with custom layout.

INSERT INTO FileReaderWriterJson
SOURCE( 'MSSQL'--OR 'ODBC'
, 'Data Source=localhost;Initial Catalog=Northwind;Integrated Security=true'
, 'select OrderId,CustomerId,OrderDate FROM Northwind.dbo.Orders'
)
WITH(
	    DriveId='b!0zqXLXXJh0uUMzl-JXAd9Ztngc-5utVDqRyD2lKpD2535-11HLQTR5z4hOzmA7Q0'
	  , FileId='root:/test_out.json:'
	--, FileId='root:/subfolder/test_out.json:'
	--, FileId='01N3NxxxxxxxWZYSDJ'  --exising File ID
	  , JsonOutputFormat='Multicontent' --Default , Array2D, ArrayLines ...
	--, DoNotOutputNullProperty='True'
	--, Encoding='UTF8' --UTF8WithoutBOM
  --, WriterDateTimeFormat='yyyy-MM-ddTHH:mm:ss.fff'
	
	--Example#1: Output all columns
	, LayoutMap='<?xml version="1.0"  ?>
<settings>
  <dataset id="root" main="True" readfrominput="True" />
  <map src="*" />  
</settings>'

	--Example#2: Nested JSON (Records under an array)
	/*
	, LayoutMap='<?xml version="1.0" ?>
<settings singledataset="True">
  <dataset id="root" main="True" readfrominput="True" />
  <map name="MyArray" dataset="root" maptype="DocArray">
    <map src="OrderID" name="OrderID" />
    <map src="OrderDate" name="OrderDate" />
  </map>
</settings>'
   */
   
	--Example#3: Nested JSON (Records under a sub document section)
	/*	
	, LayoutMap='<?xml version="1.0" ?>
<settings>
  <dataset id="dsRoot" main="True" readfrominput="True" />
  <map name="NestedSection">
    <map src="OrderID" name="OrderID_MyLabel" />
    <map src="OrderDate" name="OrderDate_MyLabel" />
  </map>
</settings>'
	*/
)

SQL Server

Use these SQL queries in SQL Server after you create a data source in Data Gateway:

Create / Update a JSON File in SharePoint Document Library from External Data Source (e.g. MSSQL / ODBC)

This example shows how to create / update a JSON file directly inside SharePoint Document Library using streaming approach. This example reads records from Microsoft SQL Server database and writes data to JSON file on SharePoint Document Library. If file does not exists then it creates a new one. It uses LayoutMap to generate JSON with custom layout.

DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO FileReaderWriterJson
SOURCE( ''MSSQL''--OR ''ODBC''
, ''Data Source=localhost;Initial Catalog=Northwind;Integrated Security=true''
, ''select OrderId,CustomerId,OrderDate FROM Northwind.dbo.Orders''
)
WITH(
	    DriveId=''b!0zqXLXXJh0uUMzl-JXAd9Ztngc-5utVDqRyD2lKpD2535-11HLQTR5z4hOzmA7Q0''
	  , FileId=''root:/test_out.json:''
	--, FileId=''root:/subfolder/test_out.json:''
	--, FileId=''01N3NxxxxxxxWZYSDJ''  --exising File ID
	  , JsonOutputFormat=''Multicontent'' --Default , Array2D, ArrayLines ...
	--, DoNotOutputNullProperty=''True''
	--, Encoding=''UTF8'' --UTF8WithoutBOM
  --, WriterDateTimeFormat=''yyyy-MM-ddTHH:mm:ss.fff''
	
	--Example#1: Output all columns
	, LayoutMap=''<?xml version="1.0"  ?>
<settings>
  <dataset id="root" main="True" readfrominput="True" />
  <map src="*" />  
</settings>''

	--Example#2: Nested JSON (Records under an array)
	/*
	, LayoutMap=''<?xml version="1.0" ?>
<settings singledataset="True">
  <dataset id="root" main="True" readfrominput="True" />
  <map name="MyArray" dataset="root" maptype="DocArray">
    <map src="OrderID" name="OrderID" />
    <map src="OrderDate" name="OrderDate" />
  </map>
</settings>''
   */
   
	--Example#3: Nested JSON (Records under a sub document section)
	/*	
	, LayoutMap=''<?xml version="1.0" ?>
<settings>
  <dataset id="dsRoot" main="True" readfrominput="True" />
  <map name="NestedSection">
    <map src="OrderID" name="OrderID_MyLabel" />
    <map src="OrderDate" name="OrderDate_MyLabel" />
  </map>
</settings>''
	*/
)';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_SHAREPOINT_ONLINE_IN_DATA_GATEWAY];