skip to Main Content

Add new Object to the JSON output

I have a POJO like this: public class Person { public long id; public String someOtherId; public String vollName; public int alter; } I am converting the POJO to JSON using the mixin: @JsonIncludeProperties( { "id", "name", "age", "customFields" }…

VIEW QUESTION

Why String ""[]"" is a valid json?

Why fastjson and Jackson both judge the string ""[]"" a valid JSON? @Test public void validJSON() { String jsonString1 = ""[]""; System.out.println("fastjson: " + JSON.isValid(jsonString1)); ObjectMapper objectMapper = new ObjectMapper(); boolean flag = false; try { JsonNode jsonNode1 = objectMapper.readTree(jsonString1);…

VIEW QUESTION
Back To Top
Search