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

error while parsing JSON data in the bean using simple-json

I am getting the following error when passing JSON data from a javascript function to a bean. ***java.lang.String cannot be cast to org.json.simple.JSONArray***. I am using json-simple to parse the data the in the backend I am using an a4j Js…
0
votes
0 answers

Parsing single-quote JSON String field

Basically, I'm trying to do this: @Test public void testCreateFromString() { BasicDBObject obj = new BasicDBObject("{'username': 'xirby'}"); assertNotNull(obj.get("username")); } @Test public void testCreateQueryFromString() { …
quarks
  • 33,478
  • 73
  • 290
  • 513
0
votes
3 answers

Create JSON file with deep array

I need to create new json file with the following structre I am not able to success since i have structure inside structure/array ,the file should look like : any idea how to create one like this? { "Entry1": [ { "id":…
Ben Hendo
  • 13
  • 4
0
votes
1 answer

json-simple How to get value from index?

I want to get a value from json based on index. The code bellow is working but I get the value from a String reference. String…
adrianogf
  • 171
  • 2
  • 12
0
votes
1 answer

Insert node in a JSON String

Using Google Gson library how can I inject a element in the root node of a JSON string? With JSON.Simple it very easy: String json = ... JSONObject jsonObj = (JSONObject) JSONValue.parse(json); jsonObj.put("hey", "yow!"); …
quarks
  • 33,478
  • 73
  • 290
  • 513
0
votes
2 answers

print values from json file

I'm using the following code to get JSON data from file, currently I was able to achieve the JSON but in one string. I want to parse it to array. The json file is like this: { "employee": [ { "name": "joan", …
0
votes
2 answers

Why does my JSON-Simple JSONArray give me a nullpointer exception?

I'm following this tutuorial here, and my JSON object is near enough the same, except I have this sort of format: {"user":{ "SomeKeys":"SomeValues", "SomeList":["val1","val2"] } } Here is my relevant code: Object obj = parser.parse(new…
AncientSwordRage
  • 7,086
  • 19
  • 90
  • 173
0
votes
1 answer

Java 1.4 String.replaceAll issue with single quote

I've got a string value coming from a database that has to be put into JSON, but the value can contain single and double quotes. Sounds easy enough, right? Well, apparently not in Java 1.4.2. Don't get me started on why it has to be 1.4.2, I…
Kettch19
  • 394
  • 8
  • 25
0
votes
1 answer

Manipulating JSON List and Map in Java

I'm working on a project that save/retrieve JSON-type string to a database. Everything works ok, i.e., save and update is safe for types String,Number and Boolean, but for List and Map, I want to see what is the safe way to manipulate List and Map…
quarks
  • 33,478
  • 73
  • 290
  • 513
0
votes
2 answers

Why does JSONObject not encode my class?

import org.json.simple.JSONArray; import org.json.simple.JSONAware; import org.json.simple.JSONObject; import org.json.simple.JSONValue; public class JsonTest implements JSONAware { private final int x, y; public JsonTest(int x, int y) { …
Enoon
  • 421
  • 4
  • 17
-1
votes
1 answer

json-simple retrieving unwanted characters

I am trying to access a json array using json-simple dependency productObject.get("description") productObject is a jsonObject . Gives me "Bhadohi, the ‘Carpet city of India’" unwanted characters . In the json file it is "Bhadohi, the ‘Carpet…
deon lobo
  • 23
  • 2
-1
votes
1 answer

My json file is being cut off at the end at ~250 000 chars when using json simple

I wrote a program to parse Minecraft map images into json so they can be used by a plugin to write into the world. My program runs without fault each time and doesn't throw any errors. However, when I open the json file, it seems to be cut off at…
-1
votes
1 answer

Not able to build a JSON object correctly using JSONObject

I have the following program which is building the JSON object. Not sure how to build array of arrays using following program. pom.xml com.googlecode.json-simple json-simple
Nital
  • 5,784
  • 26
  • 103
  • 195
-1
votes
4 answers

java decode json help (using json-simple)

I know that asking for making something is bad but it's first time I'm stucked in java. Recently I began to learn java and for my small tool I need to read this json string. Half a day I was searching and trying to make things work and founded…
jsHate
  • 499
  • 1
  • 3
  • 20
-2
votes
1 answer

JSON-Simple. Modify and use complex object

I am using the JSON-simple library to parse the Json format. How can I use or modify something to a JSONArray? For e.g. consider the following json "Place": [ { "name": "owner 1" }, { "name": "owner 2" } ], "branch":…
1 2 3
15
16