Skip to content
This repository was archived by the owner on Apr 14, 2023. It is now read-only.
This repository was archived by the owner on Apr 14, 2023. It is now read-only.

Misleading exception when trying to deserialize JSON String as org.json.JSONArray value #15

@zpj824

Description

@zpj824
public class TestDomain {
    private Integer id;
    private String name;
    private Double da;
    private LocalDateTime ldt;
    private LocalDate ld;
    private LocalTime lt;
    private JSONObject jsn;
    private JSONArray jsa;
}

execute code

public static void main(String[] args)  {

		Map map = new HashMap();
		map.put("name", "zpj");
		map.put("id", 111);
		map.put("jsa", "[1, 34, 32, \"zpj\", {\"age\": 18, \"name\": \"zpj\", \"child\": {\"name\": \"zzy\", \"gender\": \"nan\"}}, {\"url\": \"test\", \"name\": \"suhu\"}]");

		ObjectMapper om = new ObjectMapper();
		om.registerModule(new JsonOrgModule());
		TestDomain td = om.convertValue(map, TestDomain.class);
		System.out.println(td);
	}
Exception in thread "main" java.lang.IllegalArgumentException: Can not deserialize instance of org.json.JSONArray out of FIELD_NAME token
throws java.lang.IllegalArgumentException: Can not deserialize instance of org.json.JSONArray out of

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