简体   繁体   中英

need to send multimap from java to javascript in json

I am looking for suggestions on how best to send multimap values from java to javascript in json format. Besides using an object with a key field and an arraylist, are there any other options I could explore to send multimap values in json format for processing in javascript on the browser? thanks in advance

If you intend on processing all the values you might just want to send it as a list of pairs.

Otherwise then that map to lists is your friend.

Some code for clarity.

// list of pairs
[["key1", "val11"],
 ["key1", "val12"] .....]

// map to lists
{ "key1": ["val11", "val12"], ...... }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM