Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:12:28+00:00 2026-06-01T00:12:28+00:00

I have service url : please check it , It’s return json string. I

  • 0

I have service url : please check it, It’s return json string.

I don’t know how to call this url by using C#

Then. By the link, you can see "href" in json data. It’s have .png url. I would like to save that image to my local disk.

Question

  1. How to get and read json data from this service

  2. How to save image from url to local disk

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:12:30+00:00Added an answer on June 1, 2026 at 12:12 am

    Using Data Contracts and DataContractJsonSerializer:

    References Required:

    using System.Runtime.Serialization;
    using System.IO;
    using System.Runtime.Serialization.Json;
    using System.Text;
    using System.Net;
    

    Data Contract

    [DataContract]
    internal class GISData
    {
        [DataMember]
        public string href;
    
        [DataMember]
        public int width;
    
        [DataMember]
        public int height;
    
        [DataMember]
        public GISDataExtent extent;
    
        [DataMember]
        public string scale;
    }
    
    [DataContract]
    internal class GISDataExtent
    {
        [DataMember]
        public string xmin;
    
        [DataMember]
        public string ymin;
    
        [DataMember]
        public string xmax;
    
        [DataMember]
        public string ymax;
    
        [DataMember]
        public GISDataExtentSpatialReference spatialReference;
    
    }
    
    [DataContract]
    internal class GISDataExtentSpatialReference
    {
        [DataMember]
        public string wkid;
    }
    

    Putting it all together and downloading the file:

    Pull the JSON String from your URL – Deserialize the object and download your image.

    WebClient webClient;
    webClient = new WebClient();
    string json = webClient.DownloadString(@"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/export?bbox=9153621.1267%2C-644273.9207%2C13435472.9966%2C3637577.9492&bboxSR=&layers=&layerdefs=&size=800%2C600&imageSR=&format=png&transparent=false&dpi=&time=&layerTimeOptions=&f=pjson");
    
    MemoryStream stream = new MemoryStream((Encoding.UTF8.GetBytes(json)));
    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(GISData));
    stream.Position = 0;
    GISData data = (GISData)ser.ReadObject(stream);
    stream.Close();
    
    webClient = new WebClient();
    webClient.DownloadFile(data.href, "C:/" + data.href.Substring(data.href.LastIndexOf("/") + 1)); //Save only the filename and not the entire URL as a name.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HI I have a URL var str:String = conn=rtmp://server.com/service/&fileId=myfile.flv or var str:String = fileId=myfile.flv&conn=rtmp://server.com/service/
I have hard times using maven to generate my web service client. So please
Friends, I'm lost here. I have this WCF Rest service returning data in json
I have My Sharepoint Web Service URL, but when i try to access it
I have to map a REST Webservice URL like http://server:8080/application/service/customer/v1 to createCustomer method in
I currently have service classes that look something like this public class UserService :
I have a problem regarding json web service security. I tried to developed a
I have made a WCF service(service1.svc) have 2 methods. 1.GetData() 2.ProductDetails(string ProdId) Both returns
I need to call a web service from my classic ASP website. I have
I have my WCF service with URL template like.. http://localhost:8448/service/SearchProduct/{productid}/{categoryid}/{search}/{pageSize} /{currPage} Here, I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.