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
2
votes
2 answers

Java JSON decode from OMDB (IMDB) API using Java

I want to get movie data from the OMDB API which is JSON text. I am using Java to decode this and the package JSON-simple. The URL I want to decode is this for example: http://www.omdbapi.com/?t=icarus Outcome (directly copy and paste, not…
Bilzard
  • 371
  • 1
  • 5
  • 19
2
votes
1 answer

Store JSON data in Java

I want to learn JSON data storage in Java using Eclipse, so I googled a lot. I found JSON.simple and GSON. Are those a good choice? I went to Properties >> Java Build Path >> Add External JARs. I added json-simple-1.1.1.jar and…
spongebob
  • 8,370
  • 15
  • 50
  • 83
2
votes
3 answers

Decoding floating point number in simple.json Java

I am trying to read and parse a json file using simple.json in Java. However, on floating point numbers I get error. How should I parse floating point numbers? The JSON File is like: [ { "region":"NF", "destination":"d1", …
hAlE
  • 1,283
  • 3
  • 13
  • 19
2
votes
2 answers

How to write a JSONObject to a file, which has JSONArray inside it, in Java?

I have JSON file, that I need to read, edit and write out again. Reading works fine, I struggle with the write part of the JSON Array in my data. I use JSON.simple library to work with JSON in Java. The file looks like this: { "maxUsers":100, …
alena_fox_spb
  • 697
  • 1
  • 8
  • 24
2
votes
1 answer

double quote in json simple

I want this outcome: {"link":[{"url":"http://en.wikipedia.org/wiki/JScript", "label":"wikipedia"}]} I tried this: JSONObject ob1 = new JSONObject(); ob1.put("link","[{\"url\":\"http://en.wikipedia.org/wiki/JavaScript\",…
Jean
  • 1,480
  • 15
  • 27
2
votes
2 answers

Json how to get value from key with special character - json-simple

I cannot get a value from a key, because the key has a $ in it. Here is the jsonobject: JSONParser parser = new JSONParser(); String str = "{\"$oid\":\"5168d0e0b280f084c3742800\"}"; JSONObject obj = (JSONObject)parser.parse(str); String oid =…
Li'
  • 3,133
  • 10
  • 34
  • 51
2
votes
1 answer

error: package org.json.simple does not exist

I am trying to parse the return values from FourSqure.com in JSON. I dowload the json-simple-1.1.1.jar on Google and put it in the lib folder: "C:\Java\jdk1.7.0\lib" and my Java file is in this folder: "C:\Java\jdk1.7.0\bin" . I set classpth:…
jimmy
  • 39
  • 1
  • 4
1
vote
1 answer

parse json data already in an array?

I have the following data: [{"class":"test","description":"o hai","example":"a","banana":"b"}] As this JSON data is already in an array, I'm having troubles to parse this with JSON simple: File file = new File( "/Users/FLX/test.json"); String s =…
FLX
  • 4,634
  • 14
  • 47
  • 60
1
vote
4 answers

What's Wrong With This JSON?

I'm using json simple to create and parse some json. However, after creating it, I then get a ParseException when I do parser.parse(jStr);. Below is the value of…
Jesse Jashinsky
  • 10,313
  • 6
  • 38
  • 63
1
vote
4 answers

Convert JSON String to Java object for easy use in JSP

Is their an easy way or library to convert a JSON String to a Java object such that I can easily reference the elements in a JSP page? I think Map's can be referenced with simple dot notation in JSP pages, so JSON -> Map object should work? UPDATE:…
at.
  • 50,922
  • 104
  • 292
  • 461
1
vote
1 answer

I am trying to read the JSON file and print the values of each object within array, but I am having incorrect output. What did I do wrong?

So, I am using json-simple library in my project, and this is what I have right now: (I just want to print out each of the objects from the JSON file) import java.io.*; import java.util.*; import org.json.simple.*; import…
Nomad312
  • 13
  • 4
1
vote
0 answers

api layer, exchangerate // IOException : Server returned HTTP response code: 403 for URL

control.java public class control { public static void main(String[] args) { boolean success = true; String timestamp = "1659072666"; String base = "USD"; String date = "2022-07-29"; double GBP =…
MinsungLee
  • 11
  • 1
1
vote
3 answers

How to retrieve json array elements from JSON object in Java?

JSONObject firstObject = (JSONObject) jsonParser.parse(new FileReader(firstNamesPath)); I have this JSONObject, and I want to be able to access elements in the array inside of it. The object opens successfully, I just don't know how to access the…
1
vote
2 answers

Java heap space error when save json file

I get this error: "OutOfMemoryError: Java heap space", when save a big jsonObject on file with FileWriter My code: FileWriter file2 = new FileWriter("C:\\Users\\....\\test.json"); file2.write(jsonObject.toString()); file2.close(); My…
alessio1985
  • 503
  • 1
  • 5
  • 14
1
vote
1 answer

Load Data JSon in Unity

I'm trying to load the data.json file for a unity project. I don't know where I went wrong. I want to be able to load the level: level1, level2 I have tried some other ways but still not working. Can anyone review and fix the error for me. I create…
Davil
  • 11
  • 4