FRENDS⁴ Common Components : Frends.Common.Data.ConvertData.ConvertToJSON

This task takes an object as an input, which is the converted to JSON according to the following rules and parameters.

Input Parameters

  • Input
    • The object that is converted to JSON. Input can be given in the following formats:
      • XML as a C# String
      • CSV as a C# String
      • FixedLength as a C# String
  • CSVSeparator
    • If your input is CSV, enter the CSV separator here as a string, for example ,
    • Otherwise leave empty
  • FLColumnLengths
    • If your input is fixed length, enter the all of the column lengths as an array of Integers
    • Otherwise leave empty
  • InputHasHeaderRow
    • Boolean value indicating if your CSV or FixedLength file should have a header row
    • By default false
  • TrimOuputColumns
    • Boolean value indicating if the values of your CSV or fixed length input should be trimmed, for example a value of "Value 123 " would result in a JSON value of "Value 123"
    • By default false

Output Result

  • String
    • A string containing the converted JSON

Example Usage

For example calling this task, with the following input:

<DocumentElement>
  <dbo.CDInformation>
    <Title>Dark Side of The Moon</Title>
    <Artist>Pink Floyd</Artist>
    <Country>GB</Country>
    <Company>Records Label</Company>
    <Price>10.00</Price>
    <Year>1989</Year>
  </dbo.CDInformation>
</DocumentElement>

Will produce the following JSON document:

{
    'dbo.CDInformation': [
      {
        'Title': 'Dark Side of The Moon',
        'Artist': 'Pink Floyd',
        'Country': 'GB',
        'Company': 'Records Label',
        'Price': '10.00',
        'Year': '1989'
      }
    ]
}