0

I have a simple 2D array 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.

1
  • 1
    how long have you been googling it around before asking? Commented Oct 13, 2011 at 10:01

2 Answers 2

0

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.