Converting JavaScript Multi dimension Array into Java Array -


i using handsontable perform business operation while saving form retrieve data method

handsontable.getdata(); 

which returns (javascript array)

[[1,2,3],[4,5,6],[7,8,9]]  

but not able figure out way convert

list<list<integer>> 

gson automatically. think done:

gson gson = new gson(); string json = "[[1,2,3],[4,5,6],[7,8,9]]"; java.lang.reflect.type.type listoflistsofintstype = new com.google.gson.reflect.typetoken.typetoken<list<list<integer>>>(){}.gettype(); list<list<integer>> list = gson.fromjson(json, listoflistsofintstype); 

you can skip typetoken business if define class member variable of type list<list<integer>> , pass class 2nd argument fromjson().


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -