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" 
   } 
}
1
  • Are you asking for recommendations for a JSON library for Java? There are lots at json.org Commented Nov 2, 2011 at 6:48

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

0

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

http://json.org/java/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.