0

I am trying to convert an .ini file written by another java application (and is saved locally) through a web application. I was just wondering if this is possible because I've been researching and I've only found "Converting Java Object to JSon" or "How to write JSON object to File in Java".

I've also read a lot of articles and forums saying if I want to try converting to JSONObject, I should consider using GSON.

I was thinking If I could parse the ini file. But then, how can I convert the parsed ini file into json? Is there any other way I can make this possible? How ca

Hope someone can help me out on this. Thanks!

Kylie Irwin
  • 195
  • 3
  • 11
  • 3
    Possible duplicate of [What is the easiest way to parse an INI file in Java?](http://stackoverflow.com/questions/190629/what-is-the-easiest-way-to-parse-an-ini-file-in-java) your answer – Pavneet_Singh Oct 11 '16 at 07:38
  • @PavneetSingh I will try the parsing part mentioned here. Thanks. Although that is just part of what I need to do. What I need is to then convert this to a JSonObject or in JSon format so that I can return it to another web application using web service. – Kylie Irwin Oct 11 '16 at 07:49
  • once get the string values then create jsonobjects or jsonarrays because they are nothing just key-value properties , use put with key-value to insert and once you are done with json then use `json.toString()` to get the string value for transmission – Pavneet_Singh Oct 11 '16 at 07:53
  • @PavneetSingh I think I found an answer with the link that you gave me, although I'm having an error with parsing. Exception message throws parse error at the line after the comment line (#). When I try to delete that line, the error just points down to the next line. What seems to be the problem? – Kylie Irwin Oct 11 '16 at 10:54
  • 1
    you give update your question with code ans error , if possible then example or you can post a new question to get more attention from SO community but try to search you error first before doing anything – Pavneet_Singh Oct 11 '16 at 10:56
  • @PavneetSingh got it. Thanks! – Kylie Irwin Oct 11 '16 at 10:57

0 Answers0