Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cs] cs target Json. parse not support array. #8979

Closed
sonygod opened this issue Nov 19, 2019 · 2 comments
Closed

[cs] cs target Json. parse not support array. #8979

sonygod opened this issue Nov 19, 2019 · 2 comments
Milestone

Comments

@sonygod
Copy link

@sonygod sonygod commented Nov 19, 2019

    @:struct
    class Player{
        
        public var id:Null<Int>;
        
        public var arr:Array<Int>;
        
        public function new(){
            
        }
        
    }

    class Main {
        static function main() {
        
            
            var p = new Player();
            p.id = 1;
            p.arr = [1];
            
            var jp=Json.stringify(p);
            
            var rp2 = Json.parse(jp);//will throw error
            var p2 = new Player();
        
        }
    }
@RealyUniqueName

This comment has been minimized.

Copy link
Member

@RealyUniqueName RealyUniqueName commented Nov 19, 2019

Please, use markdown to format your messages: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code

@RealyUniqueName RealyUniqueName added this to the Bugs milestone Nov 19, 2019
@RealyUniqueName

This comment has been minimized.

Copy link
Member

@RealyUniqueName RealyUniqueName commented Nov 19, 2019

Array is not an issue here. It throws an exception even if Player doesn't have any fields at all. But removing @:struct fixes it.
Also it works if compiled with Haxe 3.4, so it's a regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.