Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String #2736

@aftersss

Description

@aftersss

fastjson version: 1.2.60:
Run the following code:

        JSONObject s = JSONObject.parseObject("{1:2,3:4}");
        for(String s1 : s.keySet()){
            System.out.println(s1);
        }

It will throw exception like the following:

Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at Test.main(Test.java:361)

JSONObject.keySet returns Set<String>, if I use fastjson version 1.2.29, it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions