undefined function maps:to_json/1
Programming Erlang, 2nd Ed
was written before maps were introduced in release 17 (as experimental feature) and it seems that author of book, Joe Armstrong was too optimistic about them. Still some of proposed functionality and syntax is not yet implemented (or never will be).
Luckily, there are JSON parsers for erlang which support maps, check:
- jiffy
- jsx