开发者

Passing array from javascript to ASP.NET

I have a simple 2D array开发者_C百科 in javascript. I want to pass this array to a ASP.NET page.

I wanted to know what would be the best option, going with JSON or XML.

The metric is speed and size of the data. In some cases, the array may be long in size.

Thank You.


The metric is speed and size of the data.

JSON is faster then XML in terms of speed. It's smaller then XML in terms of size.

XML is bloated to allow you to represent and validate structures.

However there are various BSON formats around where people take JSON and then hand optimise the storage format excessively. (BSON is binary JSON)

Some BSON spec I picked from google

Bison, A JavaScript parser for some arbitary BSON format.

Now if you really have bottlenecks with transferring data (which you probably don't) you may want to use WebSockets to send data over TCP rather then HTTP, thus reducing the amount of traffic and data you send.

Of course you only care about that if you making say X000 requests per second.


JSON Should be your best bet XML datatype sending might be a big pain as sometimes you would have to add in new configs just to support XML datatype to be sent as form data to the server. Genreally it is not a recommended practice due to security concerns

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜