I am trying to read a Json file (which contains a `JsonArray`) in `Amazon S3` using `Gson`, add extra 2 fields to every `JsonObject`, add the `JsonObject`s into a `JsonArray` and write the `JsonArray` back to a file.
Below is how the .json file I am reading looks like.
Below is my code, trying to do everything explained above
As you can see, I need to generate a .json file after 100 `JsonObjects` are collected. But my code generate invalid Json. It simply generate the following Json for the above code.
As you can see, it is invalid and it does not have 100 `JsonObject`s. What have I done wrong here? Please help. It is invalid because it does not close the JsonObject and JsonArray properly with brackets.
Is there no one in SO to help this problem?
PS: Please note that I made this question in here as well, but I did not get any valuable answer.>
Are you better than me? Then please show me my mistakes..
I don't see any code which writes JSON, so it's kind of hard to comment on that code. But if your problem is that the end of the expected data is missing, chances are that the code writing the data failed to close the file (or output stream or whatever).
I don't understand what kind of help you need to post the appropriate code.
Actually... what you need to do is to explain the existing code. What's a "JsonArray"? What is this mysterious "s3" variable which seems to be in charge of everything? If you're going to use classes which aren't part of the standard Java API then the least you can do is to explain them. Or post a link to their documentation. Or something; don't just assume that somebody is going to know all about them.