Android : Writing a file as a JSON object - Naimish Verma

(98 views)

There are certain use cases in android where you need to store and retrieve the data as a JSON(JavaScript Object Notation) object from a file. There is no such defined way of storing a JSON object in a file. Data is stored in a file in the form of a string and that string is parsed into JSON. Hence, there are several challenges in parsing a string into a JSON object. The first step is to create a variable which represents a file name. In the second step, create a file object using the File class in java. In the third step create the object of FileReader, FileWriter, BufferReader and BufferWriter and initialize them with the initial value of null. The FileReader and FileWriter objects are used to open the file in ‘read’ and ‘write’ mode respectively. Similarly, the BufferReader and BufferWriter objects are used to read and write from....

June 17, 2019
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
© HAKIN9 MEDIA SP. Z O.O. SP. K. 2023
What certifications or qualifications do you hold?
Max. file size: 150 MB.
What level of experience should the ideal candidate have?
What certifications or qualifications are preferred?

Download Free eBook

Step 1 of 4

Name(Required)

We’re committed to your privacy. Hakin9 uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.