fredsa / playn

Cross platform game library for N≥4 platforms
0 stars 1 forks source link

Json.Object not handling strings correctly in GWT #223

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When building a Json.Object by putting in values, this results in "null" values 
for all string types on the GWT platform for me:

        Json.Object data = json().createObject();
        data.put("name", "string");
        data.put("other", "string");
        data.put("number", 1234);
        Json.Writer writer = json().newWriter();
        writer.object(data);
        log().info("Sending: "+writer.write());
        // Sending: {"name":null,"other":null,"number":1234}

I am using trunk, but I also think that it worked somewhen before. Not 100% 
sure what's wrong there.

Original issue reported on code.google.com by dc...@dcode.io on 2 Nov 2012 at 7:03

GoogleCodeExporter commented 9 years ago
Interesting. If I do this, BOTH work:

        Json.Object data = json().createObject();
        data.put("name", "string");
        data.put("other", "string");
        data.put("number", 1234);
        Json.Writer writer = json().newWriter();
        writer.object(data);
        log().info("Sending: "+writer.write());
        Map<String,Object> data2 = new HashMap<String,Object>();
        data2.put("string", "string");
        data2.put("number", 1234);
        writer = json().newWriter();
        writer.object(data2);
        log().info("Sending2: "+writer.write());

Original comment by dc...@dcode.io on 2 Nov 2012 at 7:14