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

Java json-simple accessing via object properties

One of my gripes with JSON-Simple is that if you have a heavily nested structure, then it becomes very verbose to access information. Consider a trivial JSON object: { "announcements": { "inGame": { "playerDied": "{arg1} has died" …
0
votes
1 answer

jsonsimple: Unhandled exception type ParseException

I'm using Eclipse and I'm trying to follow along this tutorial: https://code.google.com/p/json-simple/wiki/DecodingExamples#Example_2_-_Faster_way:_Reuse_instance_of_JSONParser But I'm encountering some problems when using a JSONParser object. When…
eager2learn
  • 1,447
  • 4
  • 24
  • 47
0
votes
3 answers

JSONArray to ArrayList

Is it possible using json-simple (and no other additional library) to convert a JSONArray to an ArrayList? I was not able to find code samples in the documentation nor on SO. This is how I do it at the moment (quite a bit…
mosquito87
  • 4,270
  • 11
  • 46
  • 77
0
votes
1 answer

How to parse JSON sections using json-simple in Java?

I'm currently using the Twitch API to get information about a livestream. However, I can't seem to get the data under the stream section for viewers and such. I'm using json-simple as a maven dependency. { "_links": { "channel":…
Nat569On
  • 23
  • 1
  • 4
0
votes
1 answer

error: non-static method get(Object) cannot be referenced from a static context

The code below shows: JavaApplication1.java:34: error: non-static method get(Object) cannot be referenced from a static context JSONArray cars = (JSONArray) JSONObject.get("cars"); import…
Ivan Teo
  • 11
  • 4
0
votes
1 answer

read nested json object using loop

I have been searching from a long time and no solutions is working for me. I have to retrieve the values from the json object using some loop , and number of nested values is random these can be 1 or may be 10. json looks like this : { …
Talib
  • 1,134
  • 5
  • 31
  • 58
0
votes
1 answer

decoding a jsonobject using json simple library in java

{ "module": "abc", "chapter": "1", "source": "Google", "error": { "1": { "sourceLanguage": "English", "message": "not found", "array": "[a, b, c]" }, "2": { "sourceLanguage": "English", "message":…
Grishma Oswal
  • 303
  • 1
  • 7
  • 22
0
votes
1 answer

JSONArray.add(E) in ArrayList cannot be applied to java.lang.String

I'm using json-simple library for working with json. I have migrated from Eclipse to AndroidStudio and few parts of code began marks as error. But still project builds normally. import org.json.simple.JSONArray; public void addParam(String[]…
cooperok
  • 4,249
  • 3
  • 30
  • 48
0
votes
3 answers

How to get the values of a JSONArray by using simple JSON in Java?

I'm trying to get just the values of a JSONArray that i can store to a ArrayList or an Array. My Code is this at the moment: JSONArray params = (JSONArray) res.get("params"); for (int j = 1; j <= params.size(); j++){ Object…
n00bst3r
  • 637
  • 2
  • 9
  • 17
0
votes
2 answers

Setting classpath to use JSON simple

I am trying to use the JSON simple library, but I just can'e execute my program with it. I am trying to compile this way: $ javac -classpath json.jar TestClass.java (json.rar is the json-simple file) And it compiles ok. But I'm having trouble…
Miguel Péres
  • 630
  • 1
  • 10
  • 19
0
votes
2 answers

JSON-Simple. Append to a JSONArray

I am using the JSON-simple library to parse the Json format. How can I append something to a JSONArray? For e.g. consider the following json { "a": "b" "features": [{/*some complex object*/}, {/*some complex object*/}] } I need to append a…
ishan3243
  • 1,870
  • 4
  • 30
  • 49
0
votes
1 answer

Path with dots for Maps in JSON (Java)

I want to make it so I can use "." to obtain values within a Map within the main Map in a JSON file. E.g. My file looks like this: http://pastie.org/private/wl6jhgnylevz2fdcncyjrg And in Java, I load the configuration to a Map (but I can always use…
Faris Rehman
  • 129
  • 1
  • 4
  • 11
0
votes
2 answers

How do I create a JSONObject?

I'm trying to "create" a JSONObject. Right now I'm using JSON-Simple and I'm trying to do something along the lines of this (sorry if any typo's are made in this example JSON file) { "valuedata": { "period": 1, "icon": "pretty" …
0
votes
1 answer

JSON Simple read arraylist that is a sub of "Example"

I need to read an arraylist with JSON simple in java. I got the code but what should I write to make it read the tree "example-array" that is a sub of the main tree "Example". Here's the json code: { "Example": { "example-array": [ …
Addemod C
  • 23
  • 6
0
votes
1 answer

Print out specific values from a JSON file (nested objects-arrays) w/ JAVA

I would like to be able to parse and print out some information from a JSON file however I get stuck whenever I try to do it with nested objects-arrays. I am using JsonSimple library. My json file: x What I have been doing so far was to modify the…