How to convert Mnesia query results to a JSON'able list?
<p>I am trying to use <a href="https://github.com/talentdeficit/jsx" rel="nofollow">JSX</a> to convert a list of tuples to a JSON object.</p>

<p>The list items are based on a record definition:</p>

<pre><code>-record(player, {index, name, description}).
</code></pre>

<p>and looks like this:</p>

<pre><code>[
    {player,1,"John Doe","Hey there"},
    {player,2,"Max Payne","I am here"}
]
</code></pre>

<p>The query function looks like this:</p>

<pre><code>select_all() -&gt;
    SelectAllFunction =
        fun() -&gt;
            qlc:eval(qlc:q(
                [Player ||
                    Player &lt;- mnesia:table(player)
                ]
            ))
        end,
    mnesia:transaction(SelectAllFunction).
</code></pre>

<p>What's the proper way to make it convertable to a JSON knowing that I have a schema of the record used and knowing the structure of tuples?</p>