private static void ProcessAuthors(StringBuilder sb, KeyValuePair <string, string> field_pair) { // Appends this /* * "author": [ * { * "family": ""Zelle"", * "given": "Rintze M." * }, * { * "family": ""Hulster"", * "given": "Erik", * "non-dropping-particle":"de" <--- we dont do this - we double quote the "family" instead * }, * { * "family": ""Kloezen"", * "given": "Wendy" * }, * { * "family":""Pronk"", * "given":"Jack T." * }, * { * "family": ""Maris"", * "given":"Antonius J. A.", <---- note that initials must be separated with a space... * "non-dropping-particle":"van" <--- we dont do this - we double quote the "family" instead * } * ] */ sb.AppendLine(" \"author\": ["); string value = field_pair.Value; // Replace the {}s value = value.Replace("{", ""); value = value.Replace("}", ""); string[] authors_split = NameTools.SplitAuthors_LEGACY(value); bool is_additional_author_item = false; foreach (string author_split in authors_split) { if (is_additional_author_item) { sb.Append(","); } else { sb.Append(" "); is_additional_author_item = true; } sb.Append(" { "); NameTools.Name name = NameTools.SplitName(author_split); sb.Append(MakeQuotedPair("family", name.last_name)); // Make sure the initials have a space between them string first_names_with_initials_separated = name.first_names; if (!String.IsNullOrEmpty(first_names_with_initials_separated)) { first_names_with_initials_separated = first_names_with_initials_separated.Replace(".", ". "); first_names_with_initials_separated = first_names_with_initials_separated.Trim(); } sb.Append(", " + MakeQuotedPair("given", first_names_with_initials_separated)); sb.Append("} "); sb.AppendLine(); } sb.AppendLine(" ]"); }