Text to Json

Provides the ability to transform a text, tab delimited data source into a JSON array structure.

Version 1

HTTP Request
POST /ado/v1/TextToJson

Header

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

Request Body

Mandatory

ParameterTypeDescription
datastringThe data.

Optional

ParameterTypeDescription
delimiterstringDefault is a \t (tab) but can be changed to any separator as specified in your data set.
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
encodingstringUse this in cases where the contents of the file are not encoded in a UTF8 format. All possible values are:
ASCII
UTF8
UTF16LittleEndian
UTF16BigEndian
ISO-8859-1

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 tab which is represented as characters \t

Examples

With Header Row
Without Header Row

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

Request

{
    "headerRow": true,
    "data": "Header 1\tHeader 2\tHeader 3\tHeader 4\nValue1\tValue\tValue 3\tTest\nValue2.1\tValue 3.1\tValue 4.1\tValue Test"
}
Code language: JSON / JSON with Comments (json)

Response

[
    {
        "Header 1": "Value1",
        "Header 2": "Value",
        "Header 3": "Value 3",
        "Header 4": "Test"
    },
    {
        "Header 1": "Value2.1",
        "Header 2": "Value 3.1",
        "Header 3": "Value 4.1",
        "Header 4": "Value Test"
    }
]
Code language: JSON / JSON with Comments (json)

The source data for this example was taken from this location … https://sample-videos.com/download-sample-csv.php#google_vignette.

The data originated in a CSV format and was modified and saved in Excel as a tab delimited format.

A schema was added to demonstrate the ability for the framework to convert specific fields in the output dataset to different data types as required.

The headerRow variable is set to false given the first row is not a header record.

Request

{
    "headerRow": false,
    "schema": {
        "Field1": "Int",
        "Field5": "Double",
        "Field6": "Double"
    },
    "data": "1\t\"Eldon Base for stackable storage shelf, platinum\"\tMuhammed MacIntyre\t3\t-213.25\t38.94\t35\tNunavut\tStorage & Organization\t0.8\n2\t\"1.7 Cubic Foot Compact \"\"Cube\"\" Office Refrigerators\"\tBarry French\t293\t457.81\t208.16\t68.02\tNunavut\tAppliances\t0.58\n3\t\"Cardinal Slant-D® Ring Binder, Heavy Gauge Vinyl\"\tBarry French\t293\t46.71\t8.69\t2.99\tNunavut\tBinders and Binder Accessories\t0.39\n4\tR380\tClay Rozendal\t483\t1198.97\t195.99\t3.99\tNunavut\tTelephones and Communication\t0.58\n5\tHolmes HEPA Air Purifier\tCarlos Soltero\t515\t30.94\t21.78\t5.94\tNunavut\tAppliances\t0.5\n6\tG.E. Longer-Life Indoor Recessed Floodlight Bulbs\tCarlos Soltero\t515\t4.43\t6.64\t4.95\tNunavut\tOffice Furnishings\t0.37\n7\t\"Angle-D Binders with Locking Rings, Label Holders\"\tCarl Jackson\t613\t-54.04\t7.3\t7.72\tNunavut\tBinders and Binder Accessories\t0.38\n8\t\"SAFCO Mobile Desk Side File, Wire Frame\"\tCarl Jackson\t613\t127.7\t42.76\t6.22\tNunavut\tStorage & Organization\t\n9\t\"SAFCO Commercial Wire Shelving, Black\"\tMonica Federle\t643\t-695.26\t138.14\t35\tNunavut\tStorage & Organization\t\n10\tXerox 198\tDorothy Badders\t678\t-226.36\t4.98\t8.33\tNunavut\tPaper\t0.38\n11\tXerox 1980\tNeola Schneider\t807\t-166.85\t4.28\t6.18\tNunavut\tPaper\t0.4\n12\tAdvantus Map Pennant Flags and Round Head Tacks\tNeola Schneider\t807\t-14.33\t3.95\t2\tNunavut\tRubber Bands\t0.53\n"
}
Code language: JSON / JSON with Comments (json)

Response

[
    {
        "Field1": 1,
        "Field2": "Eldon Base for stackable storage shelf, platinum",
        "Field3": "Muhammed MacIntyre",
        "Field4": "3",
        "Field5": -213.25,
        "Field6": 38.94,
        "Field7": "35",
        "Field8": "Nunavut",
        "Field9": "Storage & Organization",
        "Field10": "0.8"
    },
    {
        "Field1": 2,
        "Field2": "1.7 Cubic Foot Compact \"\"Cube\"\" Office Refrigerators\"",
        "Field3": "Barry French",
        "Field4": "293",
        "Field5": 457.81,
        "Field6": 208.16,
        "Field7": "68.02",
        "Field8": "Nunavut",
        "Field9": "Appliances",
        "Field10": "0.58"
    },
    {
        "Field1": 3,
        "Field2": "Cardinal Slant-D? Ring Binder, Heavy Gauge Vinyl",
        "Field3": "Barry French",
        "Field4": "293",
        "Field5": 46.71,
        "Field6": 8.69,
        "Field7": "2.99",
        "Field8": "Nunavut",
        "Field9": "Binders and Binder Accessories",
        "Field10": "0.39"
    },
    {
        "Field1": 4,
        "Field2": "R380",
        "Field3": "Clay Rozendal",
        "Field4": "483",
        "Field5": 1198.97,
        "Field6": 195.99,
        "Field7": "3.99",
        "Field8": "Nunavut",
        "Field9": "Telephones and Communication",
        "Field10": "0.58"
    },
    {
        "Field1": 5,
        "Field2": "Holmes HEPA Air Purifier",
        "Field3": "Carlos Soltero",
        "Field4": "515",
        "Field5": 30.94,
        "Field6": 21.78,
        "Field7": "5.94",
        "Field8": "Nunavut",
        "Field9": "Appliances",
        "Field10": "0.5"
    },
    {
        "Field1": 6,
        "Field2": "G.E. Longer-Life Indoor Recessed Floodlight Bulbs",
        "Field3": "Carlos Soltero",
        "Field4": "515",
        "Field5": 4.43,
        "Field6": 6.64,
        "Field7": "4.95",
        "Field8": "Nunavut",
        "Field9": "Office Furnishings",
        "Field10": "0.37"
    },
    {
        "Field1": 7,
        "Field2": "Angle-D Binders with Locking Rings, Label Holders",
        "Field3": "Carl Jackson",
        "Field4": "613",
        "Field5": -54.04,
        "Field6": 7.3,
        "Field7": "7.72",
        "Field8": "Nunavut",
        "Field9": "Binders and Binder Accessories",
        "Field10": "0.38"
    },
    {
        "Field1": 8,
        "Field2": "SAFCO Mobile Desk Side File, Wire Frame",
        "Field3": "Carl Jackson",
        "Field4": "613",
        "Field5": 127.7,
        "Field6": 42.76,
        "Field7": "6.22",
        "Field8": "Nunavut",
        "Field9": "Storage & Organization",
        "Field10": ""
    },
    {
        "Field1": 9,
        "Field2": "SAFCO Commercial Wire Shelving, Black",
        "Field3": "Monica Federle",
        "Field4": "643",
        "Field5": -695.26,
        "Field6": 138.14,
        "Field7": "35",
        "Field8": "Nunavut",
        "Field9": "Storage & Organization",
        "Field10": ""
    },
    {
        "Field1": 10,
        "Field2": "Xerox 198",
        "Field3": "Dorothy Badders",
        "Field4": "678",
        "Field5": -226.36,
        "Field6": 4.98,
        "Field7": "8.33",
        "Field8": "Nunavut",
        "Field9": "Paper",
        "Field10": "0.38"
    },
    {
        "Field1": 11,
        "Field2": "Xerox 1980",
        "Field3": "Neola Schneider",
        "Field4": "807",
        "Field5": -166.85,
        "Field6": 4.28,
        "Field7": "6.18",
        "Field8": "Nunavut",
        "Field9": "Paper",
        "Field10": "0.4"
    },
    {
        "Field1": 12,
        "Field2": "Advantus Map Pennant Flags and Round Head Tacks",
        "Field3": "Neola Schneider",
        "Field4": "807",
        "Field5": -14.33,
        "Field6": 3.95,
        "Field7": "2",
        "Field8": "Nunavut",
        "Field9": "Rubber Bands",
        "Field10": "0.53"
    }
]
Code language: JSON / JSON with Comments (json)