-
working with JSON values – visualize a car’s dashboard
I got a request from my colleague to visualize data which was aquired directly from the interface of an electrical drive city bus. This electical drive engine is new and the client wants to visualize the live battery data (and something more) on his website via splitscreen: a view of the bus driving on the left side and the corresponding live data on the right side, visualized as a digital dashboard.
It is going to look like this:

The data from the bus I’m about to describe was grabbed 50 times per second to a CSV file, which means I have 50 values for each parameter every second to work with.
So the csv file I received looked like this:

After removing everthing I did not need for further work, I got this:

After importing it to After Effects I realised it won’t do me no good as long as it’s not in JSON file format so I converted the CSV to JSON which then looked like this:

In After Effects it finally looks like I could work with those values:

You see After Effects interprets the JSON file in a two dimensional way: dataValue([x,y]) whereas x represents the number of entry and y stands for the entry’s parameter (0 = speed, 1 = engine, 2 = steer, 3 = charge)
Now the most basic thing I want is to have my text layer in after effects just show me the “speed” value. But it needs to change according to this JSON table. So for instance, if I look at frame 0 in my comp the text value should display the very first speed value taken from the first entry of the JSON file (which is called “dataValue([0,0])” in After effects. When I look at frame 136 the text should grab its value from “dataValue([136,0])”
I could pick whip the text layer’s source parameter to one of those values, but then I only have one constant value. I somehow need to map it to the second dimension (y) and tell After Effects the first dimension (x) should always be the same as the current frame the comp is in.
Do you have any clue how to write this expression?
Thanks a ton!
Stefan