-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConvertToNVFIX.cs
More file actions
33 lines (28 loc) · 884 Bytes
/
Copy pathConvertToNVFIX.cs
File metadata and controls
33 lines (28 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using System.Text.Json;
class Program
{
static void Main()
{
// Sample JSON input
string jsonInput = @"
{
""key1"": ""value1"",
""key2"": ""value2"",
""key3"": ""value3""
}";
// Deserialize JSON into a dictionary
var data = JsonSerializer.Deserialize<Dictionary<string, string>>(jsonInput);
// Convert dictionary to NVFIX format
string nvfix = ConvertToNVFIX(data);
// Output NVFIX format
Console.WriteLine("NVFIX Output:");
Console.WriteLine(nvfix);
}
static string ConvertToNVFIX(Dictionary<string, string> data)
{
// Convert key-value pairs into NVFIX format (key=value;key=value;)
return string.Join(";", data.Select(kvp => $"{kvp.Key}={kvp.Value}")) + ";";
}
}