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

Version 2 (2.0.0.0) makes it possible to change numeric keys back to their original form from XML, when they have been originally modified with FRENDS.Common.ConvertToJSON_v2.

Note: the task uses a recursive helper function to look through the JSON keys. Due to recursiveness, the task might blow up the stack with large inputs. If you suspect that your input contains many nested arrays or braces-enclosed data, be sure to test the task thoroughly.

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
  • JsonNumericKeysAppendedWith
    • If numeric JSON keys were changed before conversion to XML and the user needs to bring them back to their original state, enter the appended string here.
    • 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
  • omitXMLRootElement
    • Boolean value indicating if the XML root element should be omitted from the resulting JSON
    • By default false

Output Result

  • String
    • A string containing the converted JSON

Example Usage

For example calling this task, with JsonAppendNumericKeysWith set to "foo", omitXMLRootElement set to "true", and with the following input:

<root>
	<expand>schema,names</expand>
	<startAt>0</startAt>
	<maxResults>1000</maxResults>
	<total>36</total>
	<issues>
		<expand>operations,versionedRepresentations,editmeta,changelog,transitions,renderedFields</expand>
		<id>204588</id>
		<self>https://teams.hiq.fi/jira/rest/api/2/issue/xxxxx</self>
		<key>YYY-6</key>
		<fields>
			<assignee>
				<self>https://teams.hiq.fi/jira/rest/api/2/user?username=user1</self>
				<name>User1</name>
				<key>user1</key>
				<emailAddress>user1@hiq.fi</emailAddress>
				<avatarUrls>
					<foo48x48>https://teams.hiq.fi/jira/secure/useravatar</foo48x48>
					<foo24x24>https://teams.hiq.fi/jira/secure/useravatar?size=small</foo24x24>
					<foo16x16>https://teams.hiq.fi/jira/secure/useravatar?size=xsmall</foo16x16>
					<foo32x32>https://teams.hiq.fi/jira/secure/useravatar?size=medium</foo32x32>
				</avatarUrls>
				<displayName>User1</displayName>
				<active>true</active>
				<timeZone>Europe/Helsinki</timeZone>
			</assignee>
		</fields>
	</issues>
</root>


Will produce the following JSON document:

{
	"expand": "schema,names",
	"startAt": "0",
	"maxResults": "1000",
	"total": "36",
	"issues": {
		"expand": "operations,versionedRepresentations,editmeta,changelog,transitions,renderedFields",
		"id": "204588",
		"self": "https://teams.hiq.fi/jira/rest/api/2/issue/xxxxx",
		"key": "YYY-6",
		"fields": {
			"assignee": {
				"self": "https://teams.hiq.fi/jira/rest/api/2/user?username=user1",
				"name": "User1",
				"key": "user1",
				"emailAddress": "user1@hiq.fi",
				"avatarUrls": {
					"48x48": "https://teams.hiq.fi/jira/secure/useravatar",
					"24x24": "https://teams.hiq.fi/jira/secure/useravatar?size=small",
					"16x16": "https://teams.hiq.fi/jira/secure/useravatar?size=xsmall",
					"32x32": "https://teams.hiq.fi/jira/secure/useravatar?size=medium"
				},
				"displayName": "User1",
				"active": "true",
				"timeZone": "Europe/Helsinki"
			}
		}
	}
}