I am using Jquery in my J2EE application. I am still using XML to get pass and get the data from the 开发者_如何学Pythonserver. My client side code is very vague to see. Is it better to move from XML to JSON ?
There have been big discussions about XML
vs. JSON
. Speaking in performance, there is actually no way around JSON
. Its just so well recognized
by JavaScript. Parsing & Encoding is way way faster than XML
.
Still, there is a right to exist for XML
. If you got very large datastructures with lots of information for instance, XML
might be a better choice.
So I think it really depends on what kind of data structure you want to transfer, but in general, I'd always prefer JSON
for server->client (javascript) data transfer.
Further read: When to prefer JSON over XML?
精彩评论