Arduino Yun - JSON, FUN and ticker - JY-LKM1638

Hello, I just got an Arduino Yun, yay!!! I know there are some amazing programmers here and I’d love your advice on how to make the below ticker.

I’m wanting to pull the data from 2 sources. http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast and https://btc-e.com/api/2/btc_usd/ticker

I would then like to decode the JSON and store it, and refresh the values quite often. Then I’d like to call and output the value to a 7 segment display panel, the JY-LKM1638 Which value to display will be selected by the key press on the JY-LKM1638.

Thanks so much, you are amazing if you can help me!!! HOORAY!!!!

If you end up decoding JSON in C, this one seems minimal/fast: http://zserge.com/jsmn.html

Thanks pinMode!!! I'll check that out, looks good!!!

Hi Everyone, Would still love help in getting even just the beginning of the code written, any help would be much appreciated. Thanks so much. Gray

Hello, I'm still having a horrible time of parsing JSON. How can I take the following information from https://btc-e.com/api/2/btc_usd/ticker and parse it with the ability to the put it into a string (eg have the 'High' value put into a string)?

Thanks so much!!!

I've tried this but I know it's not right at all

  HttpClient client;   
  client.get("https://btc-e.com/api/2/btc_usd/ticker");
  response = "";
  while (client.available()) {
    char c = client.read();
    response += c;
  } 
  Bridge.put("json", response); // send response in JSON format
  Bridge.get("high", data, 10); //get latest parsed data
  Console.print("data: ");
  Console.println(data);

I would do these kind of things with python

import json
import pycurl

contents = ""

def body_callback(buf):
    global contents
    contents = contents + buf

c = pycurl.Curl()
c.setopt(c.URL, "https://btc-e.com/api/2/btc_usd/ticker")
c.setopt(c.WRITEFUNCTION, body_callback)
c.perform()
c.close()

print json.loads(contents)["ticker"]["high"]

And then call the script from Arduino using Process.runShellCommand (you need to install python-curl and python-json)