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 ...
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>
&...
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
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: ...
1
vote
1
answer
388
views
Ignore namespace attributes while serializing xml data to json
I am trying to serialize xml directly to json using JsonSerializer() but the namespace attributes are getting added as fields in the final json. Any suggestion on how to remove this? I tried with ...
2
votes
1
answer
956
views
Newtonsoft.Json DeserializeXmlNode changes tag name from number to "something"
We have a long living app that uses some feed that used to be xml, but was converted to json...
Of course we were "to lazy" to change parser from reading XmlDocument to read JObject or other ...
0
votes
2
answers
57
views
Set subclasses of class without using new?
I have classes like that:
public partial class InvoiceType
{
private UBLVersionIDType uBLVersionIDField;
private CopyIndicatorType copyIndicatorField;
private CustomerPartyType ...
1
vote
2
answers
170
views
I need to serialize json file which includes xml inside
I have JSON and I need to deserialize it.Json file includes XML inside. Any suggestions?
{"nt":0,"r":true,"o":[{"test":"20fgfgdfgdfAZ20AIgdg151","fddf":"ZregrIPgdffgfSgfg","d":"<DataPDU xmlns="urn:...