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 6775005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:51:20+00:00 2026-05-26T15:51:20+00:00

I’m currently making an application for WP7 where I’m implementing a currency exchange solution.

  • 0

I’m currently making an application for WP7 where I’m implementing a currency exchange solution. I could make it with CSV too, but every time I find a snippet which looks alright (and modify it, etc.), I just meet limitations from the C# Silverlight libraries.

So basically, I’m now trying to filter out necessary information from the Google Calculator JSON result.

Basically this is the link: Google Calculator
And this is the result of the JSON: {lhs: "10 U.S. dollars",rhs: "54.2090627 Danish kroner",error: "",icc: true}

Now, if I would like a textBlock to show “10 U.S. Dollars = 54.20 Danish Kroner”, how would I have to parse and filter this? I would basically only need the application to go to the website on the click of a button, fetch the information, and return the result formated like above!

  • 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-05-26T15:51:20+00:00Added an answer on May 26, 2026 at 3:51 pm

    This is actually pretty easy. I will illustrate making the call to the REST service and parsing the JSON data into a class. Then I think you’ll be able to do the string concatenation and display on your own.

    Start by adding a reference to the System.ServiceModel.Web assembly, which will give you access to the DataContractJsonSerializer in the System.Runtime.Serialization.Json namespace.

    Next, create a class to represent the JSON. Use auto-implemented properties whose names match the JSON returned by the service:

    public class ExchangeRate
    {
      public string lhs { get; set; }
      public string rhs { get; set; }
      public string error { get; set; }
      public string icc { get; set; }
    }
    

    I’ll assume you want to get the data when a button is clicked, so here’s a small app with a button click handler.

    using System;
    using System.Net;
    using System.Runtime.Serialization.Json;
    using System.Windows;
    using Microsoft.Phone.Controls;
    
    namespace WP7JsonClient
    {
      public partial class MainPage : PhoneApplicationPage
      {
        public MainPage()
        {
          InitializeComponent();
        }
    
        private void button1_Click( object sender, RoutedEventArgs e )
        {
          var client = new WebClient();
    
          // Callback function written in-line as a lambda statement
          client.OpenReadCompleted +=
            ( s, eargs ) =>
            {
              var serializer = new DataContractJsonSerializer( typeof( ExchangeRate ) );
              var exchangeRate = (ExchangeRate)serializer.ReadObject( eargs.Result );
    
              // display exchange rate data here...
            };
    
          var uri = new Uri( "http://www.google.com/ig/calculator?hl=en&q=10USD=?DKK" );
          client.OpenReadAsync( uri );
        }
      }
    }
    

    I’ve written the async callback method in-line as a lambda statement, but you could just as easily write that as a separate method. After the call to have the serializer read the object, the JSON data is now available as an instance of your JSON serialization class (ExchangeRate) so you can work with that object directly, perform data-binding with its properties, and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I want to construct a data frame in an Rcpp function, but when I
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

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.