The Android client sends pictures and text to the server, similar to the tweet. Can I send it in JSON format?

Source: Internet
Author: User

============ Problem Description ============


If you can, how do I turn the image into JSON format? It is best to have source code. Thank you

============ Solution 1============


Obviously, the picture and the voice byte data can be base64 when the string is emitted and assembled into JSON is possible.
Just so the flow is too much, the general picture and voice are sent with a byte thin instruction is to use the TCP socket communication, without HTTP.

============ Solution 2============


Reference 3 Floor u010665680 's reply:
Quote: Referring to the reply of the 2 floor birdsaction:

Obviously, the picture and the voice byte data can be base64 when the string is emitted and assembled into JSON is possible.
Just so the flow is too much, the general picture and voice are sent with a byte thin instruction is to use the TCP socket communication, without HTTP.
OK, thank you. I turn the picture into a string and then wrap it in Jsonobject. It is then converted to a byte to write the output stream. Is that OK?


Of course. Pictures or text, in essence, are binary data, as long as the receiving end can be restored to the original data.

The Android client sends pictures and text to the server, similar to the tweet. Can I send it in JSON format?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.