10

I have a JSON structure as given below. How can I create this Array structure programmatically?

JSON srtucture:

{ 
"Employee": 
    [ 
      { 
        "EmP325235": 
          { 
             "Name":"Rekha_S", 
             "firstName":"Rekha", 
             "phoneWork":"788908909", 
             "lastName":"S", 
             "namePrefix":"Miss", 
             "phoneMobile":"3347687878", 
             "phoneHome":"5768900909", 
             "Email":"" 
          }, 
        "Em252555": 
          { 
             "Name":"Roopa_N", 
             "firstName":"Roopa", 
             "phoneWork":"0471245367", 
             "lastName":"N", 
             "namePrefix":"", 
             "phoneMobile":"", 
             "phoneHome":"", 
             "Email":"" 
      } 
      } 
    ], 
"User_Details": 
   { 
       "USER_ID":"7890", 
        "Number":"8585858585", 
        "Password":"Passwordsgs" 
   } 
}
informatik01
  • 16,038
  • 10
  • 74
  • 104
jennifer
  • 8,133
  • 22
  • 69
  • 96

3 Answers3

4

I'd probably use the GSON library which will marshall Java objects.

There's an array example to get you started, as well as a ton of others in the user guide.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
0

use the following link the complete structure of the JSON explained.

http://json.org/java/

AmirtharajCVijay
  • 1,078
  • 11
  • 12
0

XStream provides a very convenient way to transform JSON to JAVA and back. Its annotation based and does the conversion job pretty well. Check XStream

Tushar Tarkas
  • 1,592
  • 13
  • 25