I am doing a project in android,from the client i need to send data as json which is working perfect,on the server side am using j2ee where am receiving the result as string,how can i get the result as json or how can i convert it in to json on server side for storing it in db.Thanks!!
            Asked
            
        
        
            Active
            
        
            Viewed 696 times
        
    -1
            
            
        - 
                    Can't you simply convert the received string to a JSON object?http://stackoverflow.com/questions/18192891/conversion-from-string-to-json-object-android – Nagama Inamdar Apr 01 '15 at 11:35
- 
                    Understand that JSON _is_ a string. I understand that what you want is for your recieving code to automatically get the deserialized structure, but it's important to understand that it's only JSON when it is a string. You're sending JSON, you're receiving JSON. Deserialize it. – JAAulde Apr 01 '15 at 11:45
- 
                    Thanks.. i got the answer @Daenarys Once again thanks for your valuable time.. – Suresh kumar R Apr 02 '15 at 12:20
1 Answers
0
            
            
        You can use : JSONArray jsonLinkArray = new JSONArray();
- 
                    https://code.google.com/p/google-gson/Gson gson = new Gson(); String messages = gson.toJson(messagesData); out.println("{\"Messages\":"+messages+"}"); – Apr 01 '15 at 12:01
