Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Quark 1.0 can't convert Map<String, String> to JSON #189

Open
kflynn opened this issue Jun 23, 2016 · 2 comments
Open

Quark 1.0 can't convert Map<String, String> to JSON #189

kflynn opened this issue Jun 23, 2016 · 2 comments

Comments

@kflynn
Copy link
Contributor

kflynn commented Jun 23, 2016

This is a regression since 0.7.

In check.q:

quark 1.0;

namespace check {
    String Check(String p1) {
        Map<String, String> params = { "p1": p1 };

        // ...and the JSON for the request body...
        JSONObject jParams = params.toJSON();
        String jsonParams = jParams.toString();

        return jsonParams;
    }
}

quark install --python --javascript check.q, then in Python:

from check import Check
print(Check("hello"))

and in JavaScript:

var Check = require('check').check.Check;
console.log(Check("hello"));

In both cases the output is {"p1":{"$class":"quark.Object"}}.

(I didn't try Java or Ruby. Identical brokenness in two of the target languages implies not a target language problem.)

@ark3
Copy link
Contributor

ark3 commented Jun 24, 2016

Hopefully fixed in 3fb719e

@ark3
Copy link
Contributor

ark3 commented Jun 24, 2016

I enabled the test in quarkc/test/lib/map_test.q so we shouldn't break this again. However, my "fix" is not a good one, to be sure.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants