JSON array is a ordered collection of values, which are enclosed within brackets e.g. [] and separated by comma. In this Java tutorial we will convert JSON Array to String array in Java and subsequently create JSON from Java String Array. This tutorial is similar to our last article in JSON about How to convert JSON object to Java object, instead of JSON object, here we will convert JSON array to String array or List in Java. As I said earlier, there are lot's of open source library out there which can help to parse JSON data format and we have already seen Jackson library in our last example. In this tutorial we will use GSON to parse JSON data format and create Java String array or Listfrom JSON array representation. Given the popularity of JSON as lightweight alternative of XML to transfer data from Server to client in web applications, it's becoming imperative to know about JSON data format and parsing JSON string, much like parsing XML documents and knowing about different XML parsers e.g. DOM or SAX. Since Java application development is more about reusing existing library, then coding yourself, its important to know what is available, and which library other programmers are using. So far we have seen Jackson library, and here we will explore another one called GSon.
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar