Questions tagged [json-lib]

JSON-lib is a Java-to-JSON binding API that serializes and deserializes JSON data to and from Java data structures. It also includes some support for translations between XML and JSON.

JSON-lib is a Java-to-JSON binding API, hosted at http://json-lib.sourceforge.net, designed for easy and customizable deserialization and serialization of JSON data to and from Java data structures. It also includes some support for translations between XML and JSON.

Alternatives

Alternative Java-to-JSON binding solutions with similar APIs include Jackson, Google Gson, and svenson. Yet more are listed at json.org.

Pros and cons of the different APIs are discussed in the https://stackoverflow.com/questions/338586/a-better-java-json-library post.

Performance

The latest performance benchmarks for these and other JSON serialization and deserialization solutions are available at https://github.com/eishay/jvm-serializers/wiki.

76 questions
0
votes
2 answers

Processing a string formatted as a JSONArray

We have some code where we read a JSON file into a string and then use Json-lib to process it as follows: // ... JSONObject jsonObj = (JSONObject) JSONSerializer.toJSON(jsonStr); // ... We now have a situation where the file is actually a JSONArray…
Sandeep
  • 1,245
  • 1
  • 13
  • 33
0
votes
2 answers

No class found exception while using json-lib in android

I am taking the input from the web, which is an Xml file and converting into a Json data using the library json-lib . I have created a user library and added the following jars into…
Bie
  • 1
  • 1
0
votes
0 answers

While converting JSON String to JSON array, numbers are getting rounded

While I'm converting JSON String to JSON array the decimal part is getting rounded. On below example the value given is 33648.545 and the output is 33648.547. The library used is 'json-lib-2.4-jdk15.jar'. Can any one help to resolve the case. import…
0
votes
1 answer

How to Parse complex json in Robot framework

I am loading a JSON directly from a file and I need to validate that json for number of attributes . I am using below json file having data arrays and I need to traverse through all the arrays and retrieve the values (The array is dynamic so cant…
0
votes
1 answer

Java Json parser

I'm using tomcat 5 and JSON parser net/sf/json. I import json-lib2.4-jdk15.jar in my project and add it to `common/endorsed' dir in my tomcat. But when I start my servlet I have this exception: java.lang.NoClassDefFoundError:…
nyanev
  • 11,299
  • 6
  • 47
  • 76
0
votes
1 answer

Converting 2 array objects as key - value pair in JSON object using PYTHON

I have 2 different arrays: dataList = ['a_cout', 'b_count', 'c_count'] dataList1 = [15404, 21381, 3] I am trying to merge them into a json object as Key-Value pair like : '{ "a_count" : 15401, "b_count" : 21381, "c_count" : 3 }' I am using…
0
votes
5 answers

Using json-lib to transform to java throws ClassCastException

I am using json-lib to transform json object to java. The code is as below: public class JsonConvertorDemo { public static void main(String[] args) { B b1 = new B("b1"); Map bMap = new HashMap(); …
jeffery.yuan
  • 1,177
  • 1
  • 17
  • 27
0
votes
2 answers

Error in installing jsonlib in python using cmd

I was trying to install the jsonlib in python using pip install, but the error keeps coming I've tried installing the Visual Studio C++ redis. 2015-2019. It did nothing. Using cached…
podu
  • 11
  • 1
  • 1
0
votes
1 answer

JsonParser in C with json-c Library | json_object_object_get(...) not declared

I am new here and try to implement a Json Parser. I find a Tutorial (https://linuxprograms.wordpress.com/2010/05/20/json-c-libjson-tutorial/) for a Json Parser Programm. So i have a Json-File Input like this one: { "DefaultTest": "SS", "Send":…
Sebastian
  • 7
  • 1
  • 7
0
votes
1 answer

Avoid e-notation using net.sf.json-lib

I'm using com.hynnet.json-lib to convert XML to JSON. PB here is that for long integers this library use exponents instead of full-number. Could I avoid it using this library or should I use another one? My XML:
Limmy
  • 697
  • 1
  • 13
  • 24
0
votes
0 answers

java string to json conversion using json lib

Issue here that while converting to json object decimal value get truncated. I'm using Json-lib for below code. String str = "{'key':'key','type':'string','value':9276658.1}"; JSONObject fromObject = JSONObject.fromObject(str); // sysout -> output…
Kousi
  • 440
  • 1
  • 3
  • 9
0
votes
1 answer

when use Map store field and value, how to get result if parameters is not sure

In my project, there is a JSON file like this: { "table1": [], "table2": [{ "field1": "value1", "field2": "value2", "field3": "value3" }], "table3": [] } I transfer it to a JSONObject by JSON-Lib. And there is a method to get the child…
leo
  • 35
  • 1
  • 1
  • 7
0
votes
1 answer

Java object serialization and conversion to JSON

I have a Java object. It has numerous fields that have references to other different kinds of Java objects and sometimes, to itself. This object can be best described as a map (or graph) with bi-directional references (or cycles). I am not…
user4279406
0
votes
1 answer

convert List to json

i use json-lib to convert a java Object to json string,now i define a List list=... i want to convert it to json string,but i got [{},{},{}] the CustomObject is defined as: class CustomObject{ int id; int num; } is…
eascape
  • 39
  • 7
0
votes
3 answers

java.lang.NoClassDefFoundError : net/sf/json/JSONArray

I'm trying to use json-lib (net.sj.json) on my project. I looked through some dependencies that are required for that library and I literally added all of them, but still get the NoClassDefFoundError. java.lang.NoClassDefFoundError:…
jhpark
  • 1
  • 1
  • 1
  • 1