top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to Generate or Send JSON Data at the Server Side?

0 votes
22 views
How to Generate or Send JSON Data at the Server Side?
posted Jul 14, 2017 by Arun Angadi

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes
  • Create JSON Java object
  • Add name and value pairs using put method
  • Convert it to String type using toString() method and send it to the client with content-type as \"text/xml\" or \"text/plain\"

Example

myString = new JSONObject().put(\"JSON\", \"Hello, World!\").toString();
// myString is {\"JSON\": \"Hello, World\"}
answer Jul 14, 2017 by Biswajit Maity
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...