Hi,
I am trying to use the JSONParser in Java to parse String. I have to create the object of JSONParser but don't know which maven dependency to import.
What is the JSONParser Java maven dependency code that I can add into my pom.xml file?
Thanks
Hi,
The JSONParser is a Java library for working with the JSON documents.The JSON stands for JavaScript Object Notation, which is independent data exchange format between the application.
If you want to use the JSONParser library in your project then add following code into your pom.xml file:
<dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>1.1.1</version> </dependency>
After this you will be able to create the object of JSONParser class.
Thanks
HI,
You can use following code to convert String into JSONObject:
String json="{\"name\":\"Deepak\"}"; JSONParser parser = new JSONParser(); JSONObject json = (JSONObject) parser.parse(json);
Thanks
Ads