Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15442

Export Data to JSON from Database

$
0
0
I am using MSSQL 2008 and i need help exporting data from the database to a JSON file. The following is the code i have used to store the JSON file to the MSSQL 2008 Database.

Code:

SELECT *
FROM OPENROWSET (BULK 'C:\FilesTest\Dump\sample1.JSON', SINGLE_CLOB) as j

The code above saves the JSON data in the database table. Now i need the code that can export that data back to a JSON file, in a specified path when i call it. The JSON file should look like this :

Code:

{
    "status": true,
    "detail": "Verification Successful",
    "data": {
        "Number": "000001900019",
        "Batchnumber": "677899 444404",
        "Linked": "9",
        "FullName": "Tuoyo Dante",
        "Gender": "Male",
        "LinkedEmail": null,
        "PerformanceSummary": [
            {
                "BALANCE": "0",
                "AMOUNT": "EUR  0",
                "OVERDUE_AMOUNT": "0"
            },
            {
                "BALANCE": "0",
                "AMOUNT": "EUR  2,000",
                "OVERDUE_AMOUNT": "0"
            },
            {
                "BALANCE": "8,256",
                "AMOUNT": "EUR  6,350,020",
                "OVERDUE_AMOUNT": "0"
            }
        ]
    }
}

Kindly help. Been on this for days now.

Viewing all articles
Browse latest Browse all 15442

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>