All Questions
83 questions
0
votes
1
answer
24
views
ASP.NET Core Web API - How to use XML formatter for a single endpoint while keeping JSON for others?
I have an ASP.NET Core Web API that primarily uses JSON for communication. However, I need one specific endpoint to handle XML requests and responses.
I've added a custom XmlSerializerOutputFormatter ...
-4
votes
1
answer
2k
views
Remove attribute from XML node?
I have some XML which I have to convert to JSON. The XML has nodes like
<Title xml:lang="en">The Steal In The Wheels</Title>
I want to remove this xml:lang="en" from the xml nodes.
...
0
votes
1
answer
33
views
Convert xml to json which one variable already having json format value in c#
I have XML like
"<root><name>john</name><info>{\"age\":25,\"city\":\"NYC\"}</info></root>"
When I used JsonConvert....
3
votes
1
answer
6k
views
How to accept JSON and XML both in Web API post method
[HttpPost]
[Route("Patient/$gpc.registerstudent")]
[SwaggerOperation(Summary = "Register student")]
public async Task<IActionResult> Registerstudent([...
0
votes
1
answer
148
views
After upgrading IIS server to 2019, XML api &format=xml response does not work
I have a project written in .NET and I updated my server from IIS 2012 to IIS 2019.
Before this update, every time I asked for response from the API and wrote &format=xml at the end of the URL I ...
-2
votes
2
answers
372
views
Convert Xml to Json with Attribute Id
I have an xml. I want to convert this document to a JSON file like below. How can I do that?
My XML part:
<?xml version="1.0" encoding="UTF-8"?>
<AdditionalFields>
&...
16
votes
4
answers
20k
views
Convert XML to Json Array when only one object
I am currently using Newtonsoft to convert some xml to json to return from a RestExtension.
My xml is in the form of
<Items>
<Item>
<Name>name</Name>
<Detail>...
1
vote
2
answers
2k
views
Serialize xml string to object and to json
I have following xml string format where property key is random and not known but always start with alphanumeric character
<properties>
<property key="EventId">3300</...
1
vote
1
answer
2k
views
.NET Rest API Returns Response in XML format instead of JSON
I'm sending a request in JSON format to an API, but the response comes back (content variable) in XML format (Content-type=XML) instead of JSON.
Why it's happening and how can I fix that?
public ...
2
votes
2
answers
2k
views
Convert simple JSON / XML to XML with namespaces in C# .NET
What is the best way to convert json (or straightforward XML) to XML with namespaces (or with specific schema), without using strongly typed classes (C#)? (Using XSD, XSLT, template engine or other ...
16
votes
5
answers
28k
views
How to convert XML/JSON file to C# class?
I have XML file like this:
<?xml version="1.0"?>
<catalog>
<book id="1" date="2012-02-01">
<title>XML Developer's Guide</title>
<price>44.95<...
2
votes
3
answers
672
views
How to convert JSON to XML with added custom tag in C#
I have some sample JSON on this format:
{
"id": "532-513jg-5ujkl-5jiklf",
"externalGuid": "93804jlkfes",
"tagNumber": "2KMA",
...
1
vote
2
answers
353
views
Serialization difference of root element between xml and json
I am trying to establish what is the correct JSON serialization output for a set of classes we have. We use .Net XmlSerializer for XML and JSON.Net for JSON. For a set of classes like:
public class ...
0
votes
0
answers
44
views
Issues with JSON Derived classes - receiving an error
We are having an issue getting JSON to serialize and deserialize derived classes properly. We have attempted to apply settings to a JsonConvert method, but that doesn't seem to be working.
The classes ...
0
votes
2
answers
555
views
Convert empty arrays from JSON to XML with Json.NET (Newtonsoft)
Given the following JSON:
string json = @"
{
""Identifier"": ""MyID"",
""Data"": []
}";
If I convert it to XML with: ...