Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

An error of encoding array of tuples to json #157

Closed
ildarsharafutdinov opened this Issue Sep 21, 2012 · 1 comment

Comments

Projects
None yet
3 participants

The following code seems to produce wrong output

my_controller_fun([]) ->
    {json, [
        {"test", [ 
            {"x", "1"},
            {"y", "2"},
            {"z", "3"}
        ]}
    ]}.

I expect the following JSON output

{"test":[{"x":"1"},{"y":"2"},{"z":"3"}]}

Whereas I get

{"test":{"x":"1","y":"2","z":"3"}}

Is there a workaround?

my_controller_fun('GET',[]) ->
    {json, [
        {"test", [[
            {"x", "1"},
            {"y", "2"},
            {"z", "3"}
        ]]}
    ]}.

This is work properly.

@evanmiller evanmiller closed this Jan 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment