Combine nested information from api and plot on graphic

Hi, i need some help extracting information from an API to be able to plot it in a graphic. I have an API giving me chip-counts and player names in separate JSON arrays. I want to create a graph showing chips per player. How do i this. I have been able to store the data from the API, but only als strings. Please find attached screenshots for reference.

Geetings, Just

Hi @justvervaart,

How are you currently storing this information? Have you created a device for each player?

I see you have a Device: State Node as well. When you create a device, you create device attributes, and each attribute must have a data type. Attributes default to the “Number” type when created unless they are reconfigured. Is this where your data is being stored as a string?

Please let me know if you have any additional questions as well.


Hi @JuliaKempf,

i created 1 device for all players with with 2 attributes both with a string as a data type. But i guess this may not be the best approach?

Hi @justvervaart,

The best approach is going to depend on what you’d like to do with your data and what data points are valuable to you. If you’d like to show the number of chips per player, I would recommend creating a device structure similar to your virtual layout. The way you have currently structured your data will not allow you to graph the number of chips per player, as the data is stored in a Time Series database.

Looking at your payload, it looks as though you have at least one constant, possibly two: table/seat and player. The way you store your data is going to depend on your use case, but I would recommend creating your devices in Losant to build a virtual representation of your environment.

If your goal is to visualize this data with a graph, you could create devices for your table and seat structure or your player structure:

  • If you were to take the table/seat model, you could then have each device contain a username string attribute and a chip count number attribute. You’d then be able to visualize on a graph the number of chips per playing user based on the seat.

  • If you are looking to visualize all users and see how many chips they have available, you would want to create a device for each user, but this can be costly as far as devices go depending on the number of players you will have.

Let me know if either of these will work for your use case!