using System.Collections.Generic;
using Newtonsoft.Json.Linq;
public static void Main()
""self"": ""http://localhost:8080/rest/api/2/issue/BULK-62"",
""summary"": ""testing"",
""self"": ""http://localhost:8080/rest/api/2/issuetype/5"",
""description"": ""The sub-task of the issue"",
""iconUrl"": ""http://localhost:8080/images/icons/issue_subtask.gif"",
""customfield_10071"": null
""transitions"": ""http://localhost:8080/rest/api/2/issue/BULK-62/transitions""
""self"": ""http://localhost:8080/rest/api/2/issue/BULK-47"",
""summary"": ""Cheese v1 2.0 issue"",
""self"": ""http://localhost:8080/rest/api/2/issuetype/3"",
""description"": ""A task that needs to be done."",
""iconUrl"": ""http://localhost:8080/images/icons/task.gif"",
""transitions"": ""http://localhost:8080/rest/api/2/issue/BULK-47/transitions""
var columnPathMappings = new Dictionary<string, string>
{ "summary", "fields.summary" },
{ "issue type", "fields.issuetype.name" },
string csv = JArray.Parse(json).Cast<JObject>().ToCsv(columnPathMappings);
public static class JsonHelper
public static string ToCsv(this IEnumerable<JObject> items, Dictionary<string, string> columnPathMappings)
if (items == null || columnPathMappings == null)
throw new ArgumentNullException();
var rows = new List<string>();
rows.Add(columnPathMappings.Keys.ToCsv());
foreach (JObject item in items)
rows.Add(columnPathMappings.Values.Select(path => item.SelectToken(path)).ToCsv());
return string.Join(Environment.NewLine, rows);
public static string ToCsv(this IEnumerable<object> values)
const string quote = "\"";
const string doubleQuote = "\"\"";
return string.Join(",", values.Select(v => v != null ? string.Concat(quote, v.ToString().Replace(quote, doubleQuote), quote) : string.Empty));