Unmarshal JSON function in repository github.com/brocaar/lorawan


#1

Hi,

I’ve been using the package mentioned in the title to parse, craft, sign, etc. lorawan packets, complementing a security tool.

There’s a function in the package that marshals a PHYPayload to a JSON string, which is very useful. Nevertheless, I couldn’t find functionality to unmarshal a JSON string into a PHYPayload struct. This function would allow me to create a lorawan packet in an easy readable way (from a JSON string) and I was wondering if it’s possible to implement it? If so, can you provide me any directions on how to figure it out?

Best,


#2

This is not possible. The Binary to JSON is easy, however the way back is tricky as for some fields (like the mac-commands), you don’t know the types.