More Advanced Macros

More Advanced Macros

88 Downloads

JSON doesn't parse anonymous object lists.

MajsterTynek opened this issue ยท 2 comments

commented

require 'json' . parse ( '[{"foo":123},{"bar":456},{"baz":789}]' )
image
found this out byt rying to parse response from
Mojang API (Playernames -> UUIDs; endpoint)

commented

@ArowShot I have found fix for this issue!

        library.set("parse", new OneArgFunction() {
            @Override
            public LuaValue call(LuaValue arg) {
                String json = arg.checkjstring();
                JsonElement jsonElement = new JsonParser().parse(json);
                return toLua(jsonElement);
            }
        });
commented

Thanks for reporting and fixing this.