Search code examples
javajettison

Write json to text file, jettison


I have created a JSONOBject JSONObject features = new JSONObject(); which I want to store it in a txt file. I am using Jettison LIbrary for handling json files. However I didn't find a way to write json to file. Any idea?


Solution

  • You can use Json Writer to create a text which can be stored in a file. The text generated here abides all of the syntax rules of JSON and allows you to save the JSON object as text file.