Guest User

Untitled

a guest
Dec 6th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. def slurper = new groovy.json.JsonSlurper()
  2. def json = slurper.parseText(myjson)
  3. result = [:]
  4.  
  5. json.each {
  6. result.put(json.menu.items.id,json.menu.items.label)
  7.  
  8. }
  9.  
  10. println result
  11.  
  12. {
  13. "menu":{
  14. "header":"SVG Viewer",
  15. "items":[
  16. {
  17. "id":"Open"
  18. },
  19. {
  20. "id":"OpenNew",
  21. "label":"Open New"
  22. },
  23. null,
  24. {
  25. "id":"ZoomIn",
  26. "label":"Zoom In"
  27. },
  28. {
  29. "id":"ZoomOut",
  30. "label":"Zoom Out"
  31. },
  32. {
  33. "id":"OriginalView",
  34. "label":"Original View"
  35. },
  36. null,
  37. {
  38. "id":"Quality"
  39. },
  40. {
  41. "id":"Pause"
  42. },
  43. {
  44. "id":"Mute"
  45. },
  46. null,
  47. {
  48. "id":"Find",
  49. "label":"Find..."
  50. },
  51. {
  52. "id":"FindAgain",
  53. "label":"Find Again"
  54. },
  55. {
  56. "id":"Copy"
  57. },
  58. {
  59. "id":"CopyAgain",
  60. "label":"Copy Again"
  61. },
  62. {
  63. "id":"CopySVG",
  64. "label":"Copy SVG"
  65. },
  66. {
  67. "id":"ViewSVG",
  68. "label":"View SVG"
  69. },
  70. {
  71. "id":"ViewSource",
  72. "label":"View Source"
  73. },
  74. {
  75. "id":"SaveAs",
  76. "label":"Save As"
  77. },
  78. null,
  79. {
  80. "id":"Help"
  81. },
  82. {
  83. "id":"About",
  84. "label":"About Adobe CVG Viewer..."
  85. }
  86. ]
  87. }
  88. }
Add Comment
Please, Sign In to add comment