Here we'll get the contents of object result exactly as before. JSONArray result = CDL.toJSONArray(ja, string) We have an alternative way of doing this where we can achieve the same functionality by supplying a JSONArray to get the headers and a comma delimited String working as the data.Īgain, we separate different lines using a carriage return (\r) or line feed (\n): JSONArray ja = new JSONArray() Notice that both data and header were supplied within the same String. The object JSONArray result now consists of the following (output formatted for the sake of clarity): [ JSONArray result = CDL.toJSONArray(string) The first line is interpreted as a list of headers, and all the subsequent lines are treated as data: String string = "name, city, age \n" This method is overloaded and supports a wide range of data types.įor a complete list of methods supported by JSONArray, visit the official documentation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |