-1
String a = "{
 "colmdl":[{"field":"srrno"},
    {"field":"loadport"}],
 "suppressClipboardPaste":true,
 "excelSheetName":"Grid_sheet",
 "editable":true,
 "excelExportType":"Toolbar"
}"

this is I stored in as a string , i need to set this as a map.

for ex colmdl,suppressClipboardPaste,excelSheetName,editable, excelExportType these all should be key.

Mohanraj
  • 1
  • 2
  • That looks looks like JSON object. Parse it using some JSON parser and you should get JSONObject which should eliminate need to having a Map (or if not you can easily crate a Map by using key-value pars from that object). – Pshemo Aug 19 '20 at 13:54

2 Answers2

1

If you still looking for a map, it should be Map<String,Object>. Here is example using ObjectMapper from Jackson library.

String json = "{ ... }"
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> map = mapper.readValue(json,new TypeReference<Map<String, Object>>(){})
Traycho Ivanov
  • 2,887
  • 14
  • 24
0

That's JSON data, so you need a JSON reading tool. You need a library to do this. For example, Jackson.

rzwitserloot
  • 85,357
  • 5
  • 51
  • 72