JSON decompressing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robertybob
    New Member
    • Feb 2013
    • 116

    JSON decompressing

    Hi

    I am retrieving a file from a server, say http://www.abc.com/abc.json which is compressed.

    What is the method of reading the response in vb.net (visual studio)? ie, decompressing it first then reading it?

    My general method is as follows but it doesn't like reading the data since it's compressed I guess.

    Code:
    Dim Url As String = "https://www.abc.com/abc.json"
    Dim request As WebRequest = Nothing
    Dim response As WebResponse = Nothing
    Dim strResponseStatus As String = ""
    request = WebRequest.Create(New Uri(Url))
    request.Method = "GET"
    request.ContentType = "application/json-rpc"
    response = request.GetResponse()
    Thanks!
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    If its compressed you need to know what kind of compression was used then decompress after you receive it.

    Comment

    • robertybob
      New Member
      • Feb 2013
      • 116

      #3
      ok - the decompressing bit I figured but that is the code I'm stuck on. as for the type of compression, that I can't be sure about but let's assume gzip.

      Comment

      • iam_clint
        Recognized Expert Top Contributor
        • Jul 2006
        • 1207

        #4
        Provides methods and properties used to compress and decompress streams by using the GZip data format specification.

        system.io.compr ession namespace has a gzipstream

        Comment

        • robertybob
          New Member
          • Feb 2013
          • 116

          #5
          Thx Clint - been sidetracked on something at the moment but will try to check back with this shortly

          Comment

          Working...