Skip to content

ClassCastException in JSONObject.valueToString() #167

@stleary

Description

@stleary

JSONObject.valueToString(Object) is a public static method. It is expected, but not required, that it will only be called for JSONObject values. The following code will result in a ClassCastException in the JSONObject(Map<String, Object>) constructor:

    Map<Integer, String> myMap = new HashMap<Integer, String>();
    myMap.put(1,  "myValue");
    String str = JSONObject.valueToString(myMap);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions