简体   繁体   中英

Why JSON format is important for android apps? and Who specifies that I should use it or no in my app?

I am not too old in android development, so sorry if the question is so stupid. I have recently learnt about JSON data format and downloading JSON data arrays and objects in my app? but in all tutorials I have seen the instructor creates a JSON file him self and upload it online then download it from the android app(which he is creating the tutorial about). I Know that it is faster than xml it downloading and rendering but who to know that the data I am downloading is in JSON or not? who specifies that? Thank u in advance.

The server define the response and the client (mobile app) should be prepared to receive the data in the specified content type from the server.

JSON content type example :

Content-type: application/json

Not sure what your question is really about, but some remarks:

  • JSON is just a format, very popular indeed, but its role is just the same as XML, yaml, and others: give you a structured data to deal with
  • the format is specified by the API you are using (so check the documentations). If you are downloading the data from your own server, you are totally free to chose JSON or any other format tht suit your needs
  • JSON recent popularity may be related to the recent popularity of both Node.js and MongoDB: both works in JavaScript environments (so they are particularly close to this format)
  • the general JSON popularity comes from how data is mostly used: by a web application -> JavaScript again, with native support for JSON, really handy!

Hoping it will help you :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM