Open crigiroac opened 6 years ago
Example
string xml = @"< root xmlns:json='http://james.newtonking.com/projects/json'> <edad json:Type='Integer' @>27 "; XmlDocument doc = new XmlDocument(); doc = new XmlDocument(); doc.LoadXml(xml); string json = Newtonsoft.Json.JsonConvert.SerializeXmlNode(doc);
result : {"root":{"edad":"27"}}
expected result {"root":{"edad":27}}
I have same problem with boolean type. Will there be future updates on this issue? My team use Biztalk and can't use object model.
+1
Hi, has there been any discussion about this on a separate issue somewhere at all? I'd totally be interested in seeing this for my project!
All internal data transfers are in XML, transformations with XSLT and constant conversions to/from JSON, lots of third party APIs, most of the time this isn't an issue but some APIs have issues with JSON data that is all strings. Writing out classes isn't feasible for everything so for now I rely on a homebrewed solution but it isn't perfect and quite annoying to implement, so a proper one would be incredibly awesome!
This fork is a solution, if I'm not mistaken, as per the StackOverflow link posted in the OP. Seems to be only a handful of changes to get this working, so would be nice seeing this brought over. Any thoughts on this?
+1
Also think this is a great idea to merge to the main line
++ Any updates here? Can someone please push this?
Please tell me how we can use the attribute "json: Type = 'Integer'"? to get a serialization from xml to json with the specific data type.
I found a solution presented for the handling of data types in an alternate release in the following link
https://stackoverflow.com/questions/18611139/force-jsonconvert-serializexmlnode-to-serialize-node-value-as-an-integer-or-a-bo?rq=1
Example
string xml = @"< root xmlns:json='http://james.newtonking.com/projects/json'> <edad json:Type='Integer' @>27 "; XmlDocument doc = new XmlDocument(); doc = new XmlDocument(); doc.LoadXml(xml); string json = Newtonsoft.Json.JsonConvert.SerializeXmlNode(doc);
result : {"root":{"edad":"27"}}
expected result {"root":{"edad":27}}