talentdeficit / jsx

an erlang application for consuming, producing and manipulating json. inspired by yajl
MIT License
694 stars 217 forks source link

Encode strings as strings #122

Closed xypron closed 5 years ago

xypron commented 5 years ago

I am currently using JSX to encode LoRaWAN messages. Here the values always have to be strings. I never want an array of integers.

The only way I found to enforce this was using list_to_atom("My String"). But Erlang will not garbage collect the atoms created. So after some time my program will fail.

So, please, identify how I can force JSX to output string values as strings.

talentdeficit commented 5 years ago

you can convert your lists to binaries (with list_to_binary/1 or with the unicode module) and encode those.