Json to CSV

Provides the ability to transform a single level JSON array to comma separated output.

Version 1

HTTP Request
POST /ado/v1/JsonToCsv

Header

ParameterDescription
Ocp-Apim-Subscription-KeyThe subscription key you received when you purchased a plan.

Request Body

Mandatory

ParameterTypeDescription
dataobject[]Array containing one or more single level objects.

Optional

ParameterTypeDescription
rowSeparatorstringThe characters used to delimit each row. The default value is \n
headerRowbooleanDo the contents in the data source contain a header row with field names? Default is true
escapeCharacterstringThe escape character is required in situations where the value of a field contains the character that delimits one field from the others. Default is "

Common

Further Documentation: Common Parameters

ParameterTypeDescription
filterStringA fully functioning SQL based WHERE statement that will filter the outgoing dataset to the records it determines as being included.
sortOrderObjectSorts the resulting dataset by the criteria provided.
The object should contain property names that represent properties contained within the resulting dataset with a value corresponding to the desired sort direction (i.e. ASC or DESC).
schemaObjectYou can use this parameter to override the inferred schema for properties in the incoming dataset(s).
A field will be inferred unless specific explicitly within this object.
advancedOptionsObjectIs an object with the following properties.

cultureName (String)
The specified culture determines the behaviour for aspects related to formatting numeric values and dates. Is extremely important when converting strings to dates, e.g. 05/03/2022 will be treated differently between locales. For more information on the accepted values for this property, please consult the documentation from Microsoft … https://docs.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo?view=net-6.0#culture-names-and-identifiers

isBoolean (string[])
A list of strings that are the names of all properties in the resulting dataset that should be treated as boolean values.

By default, the framework treats boolean values as 1 (true) or 0 (false). In order to differentiate the integer as a boolean, the property in question needs to be called out explicitly in this list.

Notes

The field delimiter for the contents contained within the data parameter is a comma.

Examples

With Header Row
Without Header Row

This example demonstrates a simple data set with a header row and a single data record.

Request

{
    "Data": [
        {
            "DateTimeField": "2022-04-23T18:25:43",
            "Field1": "Value 1.1",
            "Field2": "Value 1.2",
            "Field3": "Value 1.3",
            "KeyFigure1": 10.3232,
            "KeyFigure2": 10,
            "BooleanField": true
        },
        {
            "DateTimeField": "2022-05-03T14:45:15",
            "Field1": "Value 2.1",
            "Field2": "Value 2.2",
            "Field3": "Value 2.3",
            "TextField": "This is a test",
            "KeyFigure1": 16.3212,
            "KeyFigure2": 16,
            "BooleanField": false
        }
    ]
}
Code language: JSON / JSON with Comments (json)

Response

DateTimeField,Field1,Field2,Field3,KeyFigure1,KeyFigure2,BooleanField,TextField
23/04/2022 6:25:43 PM,Value 1.1,Value 1.2,Value 1.3,10.3232,10,True,
3/05/2022 2:45:15 PM,Value 2.1,Value 2.2,Value 2.3,16.3212,16,False,This is a test

Code language: JSON / JSON with Comments (json)

Request

{

    "headerRow": false,
    "data": [
        {
            "DateTimeField": "2022-04-23T18:25:43",
            "Field1": "Value 1.1",
            "Field2": "Value 1.2",
            "Field3": "Value 1.3",
            "KeyFigure1": 10.3232,
            "KeyFigure2": 10,
            "BooleanField": true
        },
        {
            "DateTimeField": "2022-05-03T14:45:15",
            "Field1": "Value 2.1",
            "Field2": "Value 2.2",
            "Field3": "Value 2.3",
            "TextField": "This is a test",
            "KeyFigure1": 16.3212,
            "KeyFigure2": 16,
            "BooleanField": false
        }
    ]
}
Code language: JSON / JSON with Comments (json)

Response

23/04/2022 6:25:43 PM,Value 1.1,Value 1.2,Value 1.3,10.3232,10,True,
3/05/2022 2:45:15 PM,Value 2.1,Value 2.2,Value 2.3,16.3212,16,False,This is a test
Code language: JSON / JSON with Comments (json)