This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

How to replace?
#1
Hi all,

I'm working on a Vestaboard API integration. And so far everything is working fine but now i want to replace the status (layout) to a readable string so i can use it in my visualization.

The Vestaboard returns the layout like this:
Code:
{
  "currentMessage": {
    "layout": "[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,8,5,12,12,15,0,23,15,18,12,4,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]",
    "id": "172c7808-52db-4eb9-9ecf-505bd00436bc"
  }
}
  And i created a JSON string of all numbers and their corresponding characters:
Code:
characters = '{"0":" ","1":"a","2":"b","3":"c","4":"d","5":"e","6":"f","7":"g","8":"h","9":"i","10":"j","11":"k","12":"l","13":"m","14":"n","15":"o","16":"p","17":"q","18":"r","19":"s","20":"t","21":"u","22":"v","23":"w","24":"x","25":"y","26":"z","27":"1","28":"2","29":"3","30":"4","31":"5","32":"6","33":"7","34":"8","35":"9","36":"0","37":"!","38":"@","39":"#","40":"$","41":"(","42":")","44":"-","46":"+","47":"&","48":"=","49":";","50":":","52":"\'","53":"\\"","54":"%","55":",","56":".","59":"/","60":"?","62":"°","63":"red","64":"orange","65":"yellow","66":"green","67":"blue","68":"purple","69":"white","70":"black","71":""}'
So now i need a script that convert the Vestaboard "layout" with the characters string.

Many thanks for your help.
Reply


Messages In This Thread
How to replace? - by Joep - 24.02.2024, 11:04
RE: How to replace? - by admin - 26.02.2024, 06:59
RE: How to replace? - by Joep - 26.02.2024, 18:22

Forum Jump: