0

At the moment I have a Visual Basic web service which returns a list of products. I also have a client written in javascript/jquery. I get the data from the web service using an ajax call. I believe soon this web service will be put on an IIS web server too. What I would like to know is,

  • Can I do JSON compression on the server side and how will the client deal with this data?
  • When this web service gets put on an IIS web server, does that do any JSON compression?

I have seen HTTP compression and GZipped mentioned

Thank you

user2681625
  • 131
  • 3
  • 18

2 Answers2

0

on server you can format data in list in JSON format by use loop

then assign JSON string to hidden field

to use this data on client side by javascript

  1. get string from hidden field by document.getElementById(hiddenfieldname).value
  2. convert string to JSON object to use by eval("(" + string from hidden field+ ")")
0

the following are the two formats of json

{
 name: "stuats",
 age: 23,
}

or

{name: "stuats", age: 23}

the second one the smallest size. because that file will not have new line character.

in server side you can remove the new line character to decrease the json file size.

if you are using java spring mvc in server side, you can use the @ResponseBody annotation

above the function which gives the json object.

this never used the new line character according to my knowledge.

Thanks

Ranjit Swain
  • 309
  • 2
  • 12
  • do you know of anything similar I can use for visual basic web service? – user2681625 Nov 07 '13 at 14:26
  • you can add one method whose return type will be FileResult in the server side controller. then convert the vb object to json object string. then remove the new line character from the string. i mean "\n". i mean something like that. then create a FileResult object inside the function. set the content and return the fileResult object. http://stackoverflow.com/questions/3604562/download-file-of-any-type-in-asp-net-mvc-using-fileresult this is written in C# format, you will have some idea from this. – Ranjit Swain Nov 08 '13 at 11:17