Is there any way to convert Java object to JSON file
Is there any way to convert Java object to JSON file ( I have array of objects and I want to export to JS开发者_如何学GoON file, properties ) >
Sure there is, I suggest you to try Google's API which provides a good boxed way to serialize/deserialize data from java objects to JSON and vice-versa.
You can have the related answers here. Go through it.
- A better Java JSON library?
You can use the JsonParser to convert the Java object to JSON string and you just write that string to a file.
精彩评论