Questions tagged [json-simple]

JSON.simple is a Java-to-JSON binding API that serializes and deserializes JSON data to and from Java data structures.

JSON.simple is a Java-to-JSON binding API designed to be a simple Java toolkit to encode or decode JSON text.

See also:

234 questions
0
votes
2 answers

json-simple.jar not found

I'm currently developing a project that needs a json creator class in java. I am trying to use the json-simple library, and have already downloaded and copied the .jar file to my projects directory. I am compiling my java file using javac -cp…
Lack265
  • 1
  • 4
0
votes
0 answers

Reading JSON File and Writing to csv

I am trying to extract the below data from the json file and convert it in to csv file. however when i try to read the json file I am getting error as "Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONArray cannot be…
0
votes
0 answers

NoClassDefFoundError when running .jar file (json-simple) - eclipse

Sorry if I am talking nonsense, I am new to java and java projects. I have been reading a lot of other peoples questions about the same problem, however even after trying, it doesn't seem to be working for me. When I run my code in the eclipse ide,…
csl-310
  • 1
  • 3
0
votes
0 answers

Use a library with idea

I am trying to use a library in my java project, I am using intelij IDEA. For some reason, in IDEA I don't have any errors, the code compile, but when I build an artefact and run it I have this error : Exception in thread "main"…
stark max
  • 63
  • 5
0
votes
2 answers

How do I write a string and integer into a JSON Array with Java?

I'm trying to create the following results in a JSON file: "numbers": [ { "small": 2, "large": 5, "type": "single" }, { "small": 10, "large": 50, "type": "double" }] I can't seem to…
0
votes
0 answers

Adding a new key and value to the end of a json array in java

So I have this basic JSON file named Test.json: [{"weight":{"1-1-2020":"50.0","1-2-2020":"50.0","1-3-2020":"50.0"}}] It's a test file to mess around with. I also have this basic writting method: public void setWeight() { try(FileReader reader…
Nope 69
  • 51
  • 5
0
votes
1 answer

Json toString output for "/"

I get a JSON response, which I parse. Then populate in a POJO. Do some work on it and finally sysops json.toString instead of printing the content of the POJO. I am using json.toString() and in the response I get "currentTime":"08\/12\/2020 02:07:31…
Sonali Gupta
  • 494
  • 1
  • 5
  • 20
0
votes
1 answer

Gradle build jar cannot find dependency at run time

I have below build.gradle file in which I have included json-simple dependency: apply plugin: 'java' repositories { mavenCentral() } dependencies { testImplementation('org.junit.jupiter:junit-jupiter-api:5.4.2') …
Vipul Tyagi
  • 547
  • 3
  • 11
  • 29
0
votes
1 answer

Adding JSON Array to already existing JSON file

I have already existing JSON file similiar to this: [{ "x": [] }] and I want to put prepared JSON Array as a value for "x" key. How to do it using JSON Simple library?
0
votes
0 answers

java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException while trying to run jar file

I'm working on a project where I've to deliver .jar file to the user. I'm using Intellij IDEA and as build system I'm using Maven. I've added json-simple as a dependency. com.googlecode.json-simple
Shahrear Bin Amin
  • 1,075
  • 13
  • 31
0
votes
1 answer

Need to build utility which will retrieve values based on the keys in nested JSON file using JSON SIMPLE api

Hi I need to build a utility which will take input in the form of key like this: source.payload.header.version It should return version 1.1.1 from the the sample json below "source":{ "payload":{ "Header":{ "version":"1.1.1" I am…
nikhil udgirkar
  • 367
  • 1
  • 7
  • 23
0
votes
2 answers

How can I get multiple json data from json file one by one?

I am trying to get specific value from json file. Here is my json file. { "books": ["book1","book2","book3","book4"], "set_with_ratio": { "tweaks_es": "7", "ratio": { "brand_defined_sets_ratio": { "default": { …
Ferdousi
  • 319
  • 5
  • 17
0
votes
1 answer

Java Parse Json Array in another Json Array json.simple

I'm using JSON.simple lib and try to parse a JSON response from HTTP GET. It works fine but I struggle decoding the following structure "example": [ { "param1": 4.88, "param2": 60, "param3": [ { "param3_1":…
Mitch
  • 27
  • 5
0
votes
1 answer

Unexpected character (g) at position 0 when trying to parse json - HttpResponseDecorator

Whenever I try to execute below script I keep getting error, saying unexpected character (g). Basically I want to be able to parse the json response and be able to get the upstream job name from it. Script: @Grapes([ …
Asif Kamran Malick
  • 2,409
  • 3
  • 25
  • 47
0
votes
1 answer

jSONArray.toJSONString() is giving not a valid string

I want to write the rest response of my endpoint that is a json in a file from controller i'm returning JSONArray OBJ in response [ { "_fields": { "key1":"value1", "key2","value2" …
Himanshi
  • 84
  • 1
  • 2
  • 13