Parsing JSON on Arduino Yún

Hi all,

I have migrated code from an old Arduino Uno + Ethernet shield project that was polling a webservice and then parsing a JSON string using the aJSON library - which this forum is familiar with.

While polling the webservice is now way easier thanks to the new HttpClient lib, what about the JSON parsing? Can I delegate this to Linino as I assume it would do a better job and potentially reduce processing time?

On Linino, /usr/lib/python2.7/bridge/ already contains and json.pyc scripts, how would I go about using them from the 32U4?

Can you think of a more elegant way?

Thanks for your contributions.

You can use json module from python Write a short script that you will call from your sketch There is also a command line tool, jshn, but I can't find documentation about it

Thanks for your answer.

Yes, I did find the jshn command. The syntax is:

jshn -r "{your JSON string}"

but its output is hardly usable...

So how can I call a python script from the sketch?

Also, any idea what the and json.pyc scripts in /usr/lib/python2.7/bridge/ are supposed to do?

Take a look at the Bridge examples. Process and ShellCommands in particular

For the record, this is what I ended up doing, using the script from /usr/lib/python2.7/bridge/

Linino side:


import sys
import json
sys.path.insert(0, '/usr/lib/python2.7/bridge/')

from bridgeclient import BridgeClient as bridgeclient

client = bridgeclient()
values = client.get('json')

jsonreader = json.JsonReader()
parsed =
client.put('data', parsed[0]['data'])


#include <Bridge.h>
#include <HttpClient.h>

HttpClient client;

char data[10];
String response;

void setup() 

void loop() 
  response = "";
  while (client.available()) {
    char c =;
    response += c;
  Bridge.put("json", response); // send response in JSON format
  Bridge.get("data", data, 10); //get latest parsed data
  Serial.print("data: ");

I hope this helps!


I'm new to Python so I have to ask.

  • Where do you put the py code that you posted, since there is a in /usr/lib/python2.7/bridge/
  • How do I call the code? HttpClient is just fetching my json resault.

Is this generally understood as the most efficient was to get and parse JSON?
I am working with wunderground and would like to do all of the webservices stuff on the linino side, creating an array there and spitting the array to the arduino side. TIPS, tricks, suggestions, examples for someone unfamiliar…unfortunately there is no choreo for Temboo.