Beta 1.0.0.4

1. BillsController - > Endpoints
2. NoticeboardController -  > Endpoints
3. ReportsController - > EndPoints
4.TransactionController -> Endpoints
5. UsersController - > Endpoints
This commit is contained in:
2024-03-09 23:30:19 +05:30
parent 8fa72ae97e
commit 10c3957ce1
13 changed files with 376 additions and 11 deletions
+33
View File
@@ -145,6 +145,39 @@ namespace APISocietyToolBox.Functions
}
public static string ConvertJsonArrayToXmlR1(string jsonArray, string rootElementName, string itemElementName)
{
// Parse JSON array to JArray
JArray array = JArray.Parse(jsonArray);
// Create the root XML element with the user-defined name
XElement rootElement = new XElement(rootElementName);
// Convert each JSON object in the array to XML elements
foreach (JObject item in array)
{
// Create an item element for each item in the array
XElement itemElement = new XElement(itemElementName);
// Convert JSON properties to XML elements with values for each item
foreach (var property in item.Properties())
{
// Add property value to XML
itemElement.Add(new XElement(property.Name, property.Value.ToString()));
}
// Add the item element to the root element
rootElement.Add(itemElement);
}
// Convert the XElement to an XML string
string xmlString = rootElement.ToString();
return xmlString;
}
// Helper method to recursively convert JToken to XML
private static XElement ConvertJTokenToXml(JToken token, XElement parentElement)
{