2

I can use struts built in json converters to serialize and deserialize json. As asked at: Using Struts 2 builtin JSON utility class

JSONPopulator populator = new JSONPopulator();
SampleVO vo = new SampleVO();
populator.populateObject(vo, map);

But It dose not work with list, for example:

List<SampleVO> listSamples = new ArrayList<>();
populator.populateObject(listSamples, map);

The error is:

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map

I found that there are convertToCollection and convertToArray methods in `JSONPopulator, they are private, and I don't know if this util class can help me?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.