Converting events from server sent events to json format

Currently, I have multiple Particles. variables(<class ‘sseclient.Event’>, format) and each is returning a single value. I would like to combine all of them into one JSON formatted variable. Any good tutorial you guys can recommend that goes over this? As always appreciate all the help!

particle events:-

<class ‘sseclient.Event’>

convert it to json or python dictionary


Just a clarification here: Particle.variable()s are not server sent events.

However, in order to transport multiple values in a single Particle.variable() you’d go for string variables which you can format as you wish, including JSON format.
You can either do that “manually” via snprintf(), use the JSON Writer class(es) provided by device OS or use one of the JSON generator libraries.

I am using the Tracker one device, I am not sure it’s programmable.

If it is please share some blog or documentation to customize it.

I am trying to implement this in python using SSEClient python library

from sseclient import SSEClient

sparkURL = ‘

messages = SSEClient(sparkURL)

for msg in messages:



output of above code is :-

<class ‘sseclient.Event’>
<class ‘sseclient.Event’>

it’s in server sent format

@mohammednisar623 This is an old post but I think exactly what you are looking for. Subscribe to spark events using python - #7 by jgskarda It has the snippet of code I used to parse the JSON formatted string MSG to be a python dictionary. Hope that chunk of code helps!

Yes, TrackerOne is fully programmable but you need Particle Workbench and the Tracker Edge firmware as a base.

Thank you very much @ScruffR

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.