2021年3月28日星期日

How to add JSON array of array to model

Currently I'm doing an API to fire JSON array of array to mysql. But I don't know how to receive the data to the model class when fire the API. I tried to use ArrayList[] but still cannot make it.

Here is the data that I need to fire.

enter image description here

enter image description here

Controller :

//insert Trip      @RequestMapping(value = "inserting", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)      public @ResponseBody String add(@RequestBody ArrayList<Trips[]>[] c) {          LOGGER.debug("start insert to database...");          for(int i=0;i<c.length;i++){               //trip = c[i];              tripsService.saveTrips(trip);           }             LOGGER.debug("insert successfull...");          return c.toString();      }  
https://stackoverflow.com/questions/66847631/how-to-add-json-array-of-array-to-model March 29, 2021 at 09:08AM

没有评论:

发表评论