使用Javascript将XML转换为JSON(并返回) [英] Convert XML to JSON (and back) using Javascript

查看:666
本文介绍了使用Javascript将XML转换为JSON(并返回)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何从XML转换为JSON然后再转换回XML?

How would you convert from XML to JSON and then back to XML?

以下工具运行良好,但不完全一致:

The following tools work quite well, but aren't completely consistent:

  • xml2json

以前是否有人遇到过这种情况?

Has anyone encountered this situation before?

推荐答案

我认为这是最好的一个:在XML和JSON之间转换

I think this is the best one: Converting between XML and JSON

请务必阅读随附文章,详细介绍了这些转换的问题,我认为您会发现这些问题很有启发性。 O'Reilly主持该文章的事实应该表明Stefan的解决方案具有优点。

Be sure to read the accompanying article on the xml.com O'Reilly site, which goes into details of the problems with these conversions, which I think you will find enlightening. The fact that O'Reilly is hosting the article should indicate that Stefan's solution has merit.

这篇关于使用Javascript将XML转换为JSON(并返回)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆