Anmol Middha
Anmol Middha

Reputation: 97

how to get the indexed json as response in spring boot?

my current json is like:

{
  "key1":"value1",
  "key2":"value2",
  "key3":"value3",
  "key4":"value4",
  "key5":"value5"
}

i want to make it like

{
   meta:{
      0: key1,
      1: key2,
      2: key3,
      3: key4,
      4: key5,
  },
  data:{
      0: value1,
      1: value2,
      2: value3,
      3: value4,
      4: value5
  }
}

i know it is easy to do in javascript but how can i accomplish my response body in this indexed format in spring boot application.

Upvotes: 0

Views: 176

Answers (1)

adxl
adxl

Reputation: 889

HashMap<HashMap<String,String>,HashMap<String,String>>

The parent hashmap is for your global object, the first child for meta and second one for data.

Upvotes: 1

Related Questions