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
1
vote
1 answer

Json.simple returns null when I try to get my JSON Values even if I have a value in my JSON

public static void smth() throws ParseException, FileNotFoundException, IOException, InterruptedException { JSONParser parser = new JSONParser(); FileReader reader = new FileReader("release.json"); Object obj =…
DaVinziBoi
  • 33
  • 9
1
vote
2 answers

JSON-Simple java.lang.String cannot be cast to java.lang.Number

I'm trying to get the LAT/LNG values from my json(as Double) seen here: { "placeNames": [ { "name": "Test", "lat": "0", "lon": "0" }, { "name": "Üsküdar Bağlarbaşı Yolu", …
muzmuz213
  • 15
  • 3
1
vote
1 answer

How to add subnode to json file using json-simple

I create json file with the folloing code: import java.io.FileWriter; import java.io.IOException; import org.json.simple.JSONObject; public class CreatingJSONDocument { public static void main(String args[]) { //Creating a JSONObject…
Ronald
  • 2,721
  • 8
  • 33
  • 44
1
vote
0 answers

How to get same attribute of multiple objects in a JSON file using Java?

I have a JSON file that has stock data of different portfolios. [ { "name": "octoberportfolio", "pathame": "C:\\Users\\Documents\\octoberportfolio.xlsx", "stocks" : { "SWN": ["Southwestern…
1
vote
2 answers

How to check if a value exists in a JSON Array for a particular key?

My JSON array file: [ { "setName": "set-1", "testTagName": "Test1", "methodName": "addCustomer" }, { "setName": "set-1", "testTagName": "Test2", "methodName": "addAccount" }, { …
AutoTester999
  • 528
  • 1
  • 6
  • 25
1
vote
0 answers

Trouble in converting JSON object to JSON Array

I am currently using the Json-simple jar file and need to convert my json object into json array, I read on many places to use: JSONParser parse = new JSONParser(); JSONObject jobj = (JSONObject) parse.parse(jsonString); JSONArray arr =…
user10127047
1
vote
1 answer

Convert Buffered Reader in JSONObject (json-simple)

i'm calling a Rest API in GET, and i need to parse the response and take the value of a key. I'm using: com.googlecode.json-simple json-simple
Toriga
  • 189
  • 2
  • 7
  • 17
1
vote
3 answers

Extracting JSON Keys from Two Dimensional Matrix

When dealing with a valid JSON which represents a two dimensional matrix: [ { "a":1, "b":2 }, { "b":3, "c":4 }, { "c":6, "a":5 } ] Using Java 1.8 and the json-simple lib: com.googlecode.json-simple
PacificNW_Lover
  • 4,746
  • 31
  • 90
  • 144
1
vote
2 answers

Parsing decimal numbers, some of which lack a decimal separator, in JSON data using JSON-Simple (Java)

I am trying to use the JSON-Simple JSON processor library. When parsing JSON fragment such as: "speed":1.13 …I call get and cast as a Double. No problem. Double speed = ( Double ) wind.get( "speed" ); But then I encounter a value without a…
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
1
vote
2 answers

key check JSONObject org.json.simple in JAVA

Key convert into jsonobject using org.json.simple. I have tried a number of ways to did it but all failed 1st way JSONObject name1 = (JSONObject) jsonObject.get(key); error : cannot convert java.lang.string to org.json.simple.json.object 2nd way…
Danish
  • 257
  • 2
  • 12
1
vote
1 answer

Accessing the inner array's values in a JSONArray

I am using IntelliJ and the Gooks Books API and I'm coding in Java while using json simple. I am writing a program where the user can type a book title in terminal and the API returns 5 books and information on each of those books. The API returns a…
Janeen
  • 35
  • 3
1
vote
1 answer

How to modify the value of a particular field in a JSON file using json-simple, after parcing the JSON file

I need to modify a particular value of a key in my json file, it is a nested JSON file and i have traversed till that key value pair but i'm not able to modify the value and don't know how to write back to the json. Using json-simple to parse the…
Shilpa
  • 13
  • 1
  • 4
1
vote
1 answer

Convert JSON Array of Objects to List

I'm having a piece of that selecting data in JSON and I want to convert it to Java ArrayList. String q = "SELECT attributes FROM common_attr_test"; PreparedStatement preparedStatement = (PreparedStatement)…
user1823924
1
vote
2 answers

Parsing JSON string and preserving key-data order when using json-simple without manually constructing HashMap

I know that this topic has been talked about, and the use of a LinkedHashMap is a 'hacky' way to maneuver this, but if I'm given thousands of JSON strings as input, and eventually want to output them back in their original form, is there anyway to…
jon givony
  • 197
  • 2
  • 3
  • 9
1
vote
1 answer

Read a CSV file and Write a Json file in Java

I modified my code: private static final String SAMPLE_CSV_FILE_PATH = "src/main/resources/testCSV.csv"; private static final String OUT_PUT_CSV_PATH = "src/main/resources/outCSV.csv"; public static void main(String[] args) throws IOException { …
LOTR94
  • 27
  • 7