JSON Object conversion of Base64 to HEX

Greetings. I’m fairly new to Losant, not really a developer but do have a sensor already MQTT-ing to a workflow, converting JSON sensor strings to objects and displaying values on a dashboard - so not bad for a developer wannabe :sunny: . But I have one problem, I’ve looked on the forums already and haven’t quite found exactly the answer to my :question: (if this topic has already been discussed/solved, by all means re-direct me to that one :slight_smile: )

All of my JSON metadata objects are ‘good’ for handling, But one is in the format of Base64. This would be my payload_raw value. I need it in HEX Base16 1 byte words format for decoding. Before I begin all over the place I would like the community for guidance: do I make a Function, Mutate, Math, etc. The right starting point would be best.

Here’s an example of payload raw message : “payload_raw”: “GAoBPg==”
Need something like : “payload” or “payload_hex”: “180A013E” (0-7 byte payload; in this case 4 byte payload : 18 0A 01 3E)

Again, any guidance, help in the right direction would be appreciated!

Thanks in advance! j :red_circle:

Hi @Jose_Cruz,

Welcome to the forums! It sounds like you’ve made a lot of progress, great work :partying_face:

I think you’ll find format helpers to be quite helpful for decoding from base64. There is also a good forum post here with a similar question on converting from hex.

Let me know if I can help any further, this is just a nudge in the right direction :smile:

Thanks!
Julia

1 Like

@JuliaKempf thank you!

This is definitely a good nudge in the right direction :smiley: I’ll get on those links asap and will let you know if further assistance is needed.

j :red_circle:

1 Like