nrm / json-simple Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/json-simple
License: Apache License 2.0
Automatically exported from code.google.com/p/json-simple
License: Apache License 2.0
can you have the JSONObject exten LinkedHashMap instead of HashMap.
This will ensure that the properties stored in the map are the same order as
JSON Object created via the browser?
Original issue reported on code.google.com by [email protected]
on 10 Mar 2011 at 9:19
Hi,
I would like to help with this project: I can provide some man power at least to fix reported bugs and apply suggested fixes when proposed and are meaningful.
I actively use JSON-SIMPLE, I like how it was written and that is compatible
with older JVM so I am in a good position to help you.
Let me know how we can work together.
Thanks in advance
Bye
Piero
Original issue reported on code.google.com by [email protected]
on 11 Aug 2011 at 9:43
What steps will reproduce the problem?
1. Invoke writeJSONString in your code
2. Watch your app in JProfiler
3. Note that a lot of time is spent in 'escape' calling String.length
What version of the product are you using? On what operating system?
Version 1-1, any OS
Suggested fix:
In JSONValue.escape(String s, StringBuffer sb), replace
for(int i=0;i<s.length();i++){
with
final int len = s.length();
for(int i=0;i<len;i++){
In addition, replace all instances of StringBuffer with StringBuilder
Original issue reported on code.google.com by [email protected]
on 28 Apr 2011 at 11:14
In order to play nicely in an OSGi environment, some simple entries in the
MANIFEST.MF must be
provided. I attachted a patch against build.xml (1.1) which use the bnd tool to
generate that
manifest (you need to download bnd.jar from http://www.aqute.biz/Code/Download
and put it into
a new "tools/" directory).
Alternatively, the generated MANIFEST.MF could be checked in and used directly
with the jar target
(which I would recommend to its simplicity). I added an example to this ticket.
It would be nice, if in some coming version the OSGi Headers would be present
so that this fine
library could be used as an OSGi Bundle as well.
thx ...
...roland.
Original issue reported on code.google.com by [email protected]
on 14 Feb 2010 at 10:48
Attachments:
What steps will reproduce the problem?
1. I fetched the data from jdbc
2. Map fields = new LinkedHashMap(); fields.put("Time", rs.getObject(i))
3. then getting json: ... "Time":2003-03-12 12:23:14.363
What is the expected output? What do you see instead?
I'd expect "Time":"2003-03-12 12:23:14.363" however the locales could be
errorous, I understand.
What version of the product are you using? On what operating system?
json-simple-1.1.jar
Please provide any additional information below.
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
Original issue reported on code.google.com by toma%[email protected]
on 5 Jun 2010 at 3:06
Hi,
in method JSONValue.escape(String s, StringBuffer sb) I think you are missing the escape of single-quote character.
Here is the proposed patch:
Index: trunk/src/org/json/simple/JSONValue.java
===================================================================
--- trunk/src/org/json/simple/JSONValue.java (revision 185)
+++ trunk/src/org/json/simple/JSONValue.java (working copy)
@@ -231,6 +231,9 @@
case '"':
sb.append("\\\"");
break;
+ case '\'':
+ sb.append("\\\'");
+ break;
case '\\':
sb.append("\\\\");
break;
Let me know what do you think about.
Bye
Piero
Original issue reported on code.google.com by [email protected]
on 10 Aug 2011 at 2:34
What steps will reproduce the problem?
1. use JSONValue.writeJsonString() or JSONValue.toJsonString() providing a
value argument of an unsupported type.
What is the expected output? What do you see instead?
the library already provides a fallback mechanism that outputs value.toString() when passing an unsupported object. This is okay, but i would expect to get surrounding quotes, as when writing normal Strings.
What version of the product are you using?
trunk (same behavior on 1.1)
The attached patch should solve the issue: it simply uses the same behavior for
String instances (escape + surrounding quotes), and for the fallback case as
well.
thanks,
alberto
Original issue reported on code.google.com by [email protected]
on 4 Aug 2010 at 7:13
Attachments:
I was looking at
http://code.google.com/p/json-simple/source/browse/trunk/doc/json.lex
It seems to have a few problems.
-0 is parsed using Long.valueOf which loses the sign bit.
0123 is treated as a valid number despite the JSON grammar specifically disallowing leading
zeroes.
http://code.google.com/p/prebake/source/browse/trunk/src/org/prebake/js/json_gra
mmar.lex
addresses that problem and makes sure that
nulltrue
does not lex as the tokens
["null", "true"]
Original issue reported on code.google.com by [email protected]
on 16 Apr 2010 at 8:24
In die DB eine Funktion hinzufügen, um den BuildingPOI per BuildingID zu
bekommen.
Konstruktor von Building so ändern, dass er die POIID nicht mehr braucht, und
die xml entsprechend ändern.
Original issue reported on code.google.com by [email protected]
on 27 Jan 2011 at 11:03
Can you please publish the Javadoc. I know the API itself is very simple, but a
simple Javadoc would go a long way to help with do's and dont's.
Original issue reported on code.google.com by [email protected]
on 21 Apr 2011 at 8:51
System.out.println(JSONValue.toJSONString("a/b/c"));
yields
"a\/b\/c"
-------
So here's the deal. After asking this question
http://stackoverflow.com/questions/1580647, it looks like the JSON spec
allows but does not require forward slashes to be escaped. (see RFC4627
http://www.ietf.org/rfc/rfc4627.txt p.4)
So technically this issue is not a bug... but it makes file paths look
really ugly.
Apparently the string "</" is problematic in a few circumstances (namely
inside <script> tags in HTML).
Is there any way you could change the behavior of json-simple so either
it's user-selectable whether forward slashes in strings are escaped, or you
only escape "</" to "<\/"?
Original issue reported on code.google.com by [email protected]
on 16 Oct 2009 at 10:23
Hello, It would be useful to include
if(value instanceof Object[])
return JSONArray.toJSONString(Arrays.asList((Object[])value));
I hope you can include this two simple lines
Thanks a lot
Original issue reported on code.google.com by [email protected]
on 6 Oct 2009 at 6:01
Hallo I try example 6.1 but i get: [User@a4edc4,User@1f5eb7f,User@381a53]
where is the problem ?
Original issue reported on code.google.com by [email protected]
on 22 Apr 2009 at 8:41
What steps will reproduce the problem?
1. Create a json file to parse with a float value in it (example: .5
2. Try to parse the data with this library
What is the expected output? What do you see instead?
Expect the file to be parsed, instead it throws an exception on the character
'.'
What version of the product are you using? On what operating system?
1.1 on WinXP
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 16 Jul 2010 at 3:54
I am planning to use parts of json-simple for http://www.jooq.org, in order to
export database results in JSON format. Among libraries that I have considered,
your library seems to provide the simplest means of doing that and our licenses
are identical.
I was wondering though, if you correctly applied the APACHE-2.0 license.
According to Apache, you should add a header to every artefact of your product.
See the appendix of the following document:
http://www.apache.org/licenses/LICENSE-2.0
In any case, thanks for implementing this!
Original issue reported on code.google.com by [email protected]
on 30 Jun 2011 at 12:19
What steps will reproduce the problem?
1. new JSONObject().put("isAlive",true);
What is the expected output? What do you see instead?
Expected : {"isAlive":true}
Instead : doesn't compile, an object is required instead of a primitive type
like 'true'.
What version of the product are you using? On what operating system?
Jdk 1.4
Original issue reported on code.google.com by [email protected]
on 29 Jul 2010 at 1:19
Hi when I run the following
jsonData = NetUtils.getHTTPFile("http://www.iobridge.com/api/feed/key=" + feedKey);
JSONParser parser = new JSONParser();
Object obj = null;
//parse the JSON data
try {
obj = parser.parse(jsonData);
} catch (ParseException e) {}
JSONArray array=(JSONArray)obj;
System.out.println(array.get(1));
JSONObject obj2=(JSONObject)array.get(1);
System.out.println(obj2.get("1"));
I get the following Exception
Exception in thread "main" java.lang.ClassCastException:
org.json.simple.JSONObject
at IOB.IOBModule.<init>(IOBModule.java:33)
at myroomcontrol.Main.main(Main.java:30)
Java Result: 1
Original issue reported on code.google.com by [email protected]
on 17 Feb 2009 at 9:31
What steps will reproduce the problem?
1. Define two strings "[1 2 3]" and "{\"key1\" \"val1\" \"key2\" \"val2\"}"
2. Pass the strings to org.json.simple.parser.JSONParser.parse()
3. No ParseException will be raised, the parser returns a valid JSONArray /
JSONObject.
What is the expected output? What do you see instead?
JSON arrays and objects have their values/key-value pairs separated by
commas. The parser, however, seems also to accept tokens that are separated
by space only. The same happens to the ":" operator for object key-value pairs.
What version of the product are you using? On what operating system?
JSON.simple 1.1 / Java 1.6 / Linux
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 5 Jan 2010 at 1:35
Attachments:
What steps will reproduce the problem?
1. Create JSONObject
2. Store java.util.Date object in created JSONObject
What is the expected output? What do you see instead?
expected: A quoted string of the date object's toString() function.
instead: Quotes are missing.
What version of the product are you using? On what operating system?
Please provide any additional information below.
This can easily be fixed in JSONValue#writeJSONString(Object value, Writer
out) => By default all non recognized Object's toString() functions should
be quoted.
Original issue reported on code.google.com by [email protected]
on 16 Feb 2010 at 3:58
According to the documentation:
http://code.google.com/p/json-simpl/wiki/MappingBetweenJSONAndJavaEntities
JSON arrays are only serialised from java.util.List. When it comes to
serialisation, I think it might be worth allowing for java.util.Collection
instead, since the serialisation is done using List.iterator().
On the other hand, serialising Object[] (or any primitive type array) to a JSON
array would be a very useful addition, too.
Original issue reported on code.google.com by [email protected]
on 30 Jun 2011 at 1:13
What steps will reproduce the problem?
1. capture a org.json.simple.parser.ParseException
2. use the 'getMessage' or 'getLocalizedMessage' API
3. returns NULL (when there is a message returned by toString)
What is the expected output? What do you see instead?
Should be the same as the 'toString()' method; or at least comparable useful.
What version of the product are you using? On what operating system?
1.1
Please provide any additional information below.
Right now the ParseException's 'toString' method is overridden. Which
leaves the get[Localized]Message APIs doing nothing. The override should
be in the get[Localized]Message and the inherited toString will work
fine. This will cover all three methods...
Original issue reported on code.google.com by [email protected]
on 9 May 2009 at 10:50
It would be better to propagate IOExceptions or ParseExceptions thrown from
JSONParser.parser() and allow developers to handle the error, rather than
test for null and guess as to the actual cause.
Original issue reported on code.google.com by [email protected]
on 29 Nov 2009 at 7:22
Attachments:
Hi there
I'm new to json-simple, tried to use it to decode a json string that
encoded by PHP(it was 2-dimension array in PHP) json_encode, the string
looks like
{"User_001":{"first_name":"xxx","last_name":"xxx","name":"xxx
xxx","uid":"1571575199","pic_square":"http://profile.ak.fbcdn.net/v230/639/72/q5
71575199_2451.jpg","profile_url":"http://www.facebook.com/profile.php?id=5715751
99"}}
but it reports error at run time:
java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast to
org.json.simple.JSONArray
any idea why? thanks for any help.
Original issue reported on code.google.com by [email protected]
on 6 Nov 2009 at 10:54
What steps will reproduce the problem?
1. Get source using svn
2. Import project into Eclipse
3. Run junit test on test/org.json.simple.Test.Java
What is the expected output? What do you see instead?
Expected:
{"array1":["abc\u0010a\/",123,222.123,true],"weight":60.21,"age":27,"name":"fang
","is_developer":true}
Instead:
{"age":27,"is_developer":true,"name":"fang","array1":["abc\u0010a\/",123,222.123
,true],"weight":60.21}
What version of the product are you using? On what operating system?
version: 1.1
OS: Windows 7 x64
Please provide any additional information below.
What is the expected ordering of the JSON object that is created?
Original issue reported on code.google.com by [email protected]
on 13 Jul 2010 at 1:09
For a project I'm working on I needed the data read my json-simple to adhere to
the order in which the original JSON string is formatted.
This can be simply accomplished by extending JSONObject from a LinkedHashMap.
Would it be an idea to make this simple change in the main version of the
json-simple library?
Thanks,
Bert Spaan
Original issue reported on code.google.com by [email protected]
on 13 Jan 2011 at 1:19
Just noticed that the one of the methods of the *.parse.ContainerFactory
interface is spelled as "creatArrayContainer" where it should be
"createArrayContainer".
Vladimir
Original issue reported on code.google.com by [email protected]
on 9 Mar 2011 at 5:28
Hi,
Not sure if this is the best way to submit this.. I added a simple mechanism
to add formatters to types. Our need is that we always want dates formatted in
a specific way.
Usage is simple, just register the formatter with JSONValue.
ex:
JSONValue.registerFormatter(Date.class, new JSONFormatter() {
@Override
public String toJSONString(Object value) {
return ((Date)value).toGMTString();
}
});
Original issue reported on code.google.com by [email protected]
on 29 Dec 2010 at 10:31
Attachments:
This implementation choice makes it impossible to use json-simple with Scala
without modification. However, everything works fine when updating the
JSONObject declaration to the following:
public class JSONObject extends HashMap<Object, Object> implements
Map<Object, Object>, JSONAware, JSONStreamAware{
This is also probably a Scala bug, but people seemed to think it is a better
practice to use typed HashMap instead of raw.
See <http://old.nabble.com/Complicated-type-error-with-
org.json.simple.JSONObject:put-td26716918.html> for full details.
Cheers,
-- Sébastien
Original issue reported on code.google.com by [email protected]
on 15 Dec 2009 at 1:20
Minor issue: JSON encoder adds a backslash before every "/" in the string.
While JSON spec *allows* to escape "/", it's not required, and escaping it
reduces readability of the encoded data, and unnecessarily increases the
size of the encoded string.
Could you consider not escaping the forward slash?
Original issue reported on code.google.com by [email protected]
on 3 Nov 2009 at 12:24
Summary:
I'm using JSON Simple in our Android application. I recently noticed I was
getting occasional OutOfMemory errors, and it turned out that
JSONParser.parse() is the problem. Parsing this simple JSON document
(http://api.qype.com/v1/places/27539/reviews.json?page=1 -- you need a
consumer key to actually see that) will cause a memory consumption of over
10 MB.
What steps will reproduce the problem?
I'm not sure whether this happens outside the Android environment. But what
I did is this:
private JSONObject parseJsonReply(InputStream data) throws ParseException,
ConnectionFailedException {
if (modelName == null || modelListName == null) {
String className = getClass().getSimpleName();
int idx = className.indexOf("Parser");
modelName = className.substring(0, idx).toLowerCase();
modelListName = modelName + "s";
}
BufferedReader reader = new BufferedReader(new
InputStreamReader(data));
StringBuilder sb = new StringBuilder();
try {
String line = reader.readLine();
while (line != null) {
sb.append(line);
line = reader.readLine();
}
} catch (IOException e) {
throw new ConnectionFailedException(e);
}
return (JSONObject) jsonParser.parse(sb.toString());
}
What version of the product are you using? On what operating system?
json-simple 1.1 on Android 1.5 (HTC Hero)
Original issue reported on code.google.com by [email protected]
on 27 Nov 2009 at 11:35
What steps will reproduce the problem?
Create a Object[] and then try to transform to a JSON string.
In example: org.json.simple.JSONValue.toJSONString(new Object[] {"1"})
What is the expected output? What do you see instead?
The output should be like the java.util.List's output. I.e.: ["1"]
The call returns a "toString()" output. I.e.: [Ljava.lang.Object;@2ad191
What version of the product are you using? On what operating system?
json_simple-1.1.jar
Please provide any additional information below.
Original issue reported on code.google.com by atec.post
on 19 Feb 2009 at 12:51
The decoding/encoding cycle of json objects with json-simple is not "stable"
since the ordering of the key-value pairs is not maintained by the parsing code.
What steps will reproduce the problem?
1. Parse a json-string of an object, ie:
{"key1":"val1","key2":"val2","key3":"val3","key4":"val4"}.
2. Then write back that same object and the order of the key-value pairs are
not preserved,
but they get the random ordering of the java.util.HashMap, ie:
{"key2":"val2","key3":"val3","key1":"val1","key4":"val4"}
What version of the product are you using? On what operating system?
version 1.1
I can think of 2 obvious solutions:
1) either to provide a ContainerFactory that returns the a LinkedHashMap,
but a subclssing might be required for its toString() method to emit proper
json as the replaced JSONObject class does,
2) modify the JSONObject code to extend from LinkedHashMap instead of from
HashMap.
Original issue reported on code.google.com by [email protected]
on 2 Sep 2010 at 4:30
What steps will reproduce the problem?
1. Run this code:
System.out.println(JSONValue.toJSONString("\u2013\u2019\u201c\u201d"));
What is the expected output? What do you see instead?
I think you should see: "–’“”"
(four punctuation characters in quotes)
But I get this: "\u2013\u2019\u201C\u201D"
What version of the product are you using? On what operating system?
json_simple 1.1, linux
Please provide any additional information below.
I looked in the unicode spec, and they are not listed as control characters.
Original issue reported on code.google.com by [email protected]
on 3 Jun 2010 at 4:27
Hi,
Right now the fallback of JSONValue.toJSONString is:
return value.toString();
Wouldn't something like the following be better, since the current
implementation can render invalid JSON with a bad toString?
return "\"" + escape(value.toString() + "\"";
Original issue reported on code.google.com by [email protected]
on 30 Jun 2010 at 1:16
I've been using JSONSimple, and needed to pretty-print json. I've extended the
writeJSONString
to accept optional indent argument, and it works well enough for me. Attached
is sample output.
While doing this, I've noticed that JSON generation code was duplicated:
toJSONString and
writeJSONString in JSONObject//Array/Value are very similar, so I changed all
toJSONString to
simply:
public static String toJSONString(Map map, int indent){
StringWriter sw = new StringWriter();
try {
writeJSONString(map, sw, indent);
} catch (IOException ex) {
Logger.getLogger(JSONObject.class.getName()).log(Level.SEVERE, null, ex);
}
return sw.toString();
}
If you are interested in any of these changes, I can make you a diff. I am not
sure what the best
way would be to make changes backward compatible, I need to pass around that
indent
argument. Extend JSONStreamAware interface?
Kudos on your clean design. Exactly what I needed, simplest reflection of js
into java.
Original issue reported on code.google.com by [email protected]
on 21 Apr 2010 at 5:28
Attachments:
Hi,
can you add to wiki a real world example?
Something like creating what is presented by Wikipedia[1] as a JSON example.
Actually I'm failing to reproduce that simple example.
Thanks
Piero
[1]http://en.wikipedia.org/wiki/JSON#Data_types.2C_syntax_and_example
Original issue reported on code.google.com by [email protected]
on 21 Feb 2011 at 3:36
What steps will reproduce the problem?
1. putting a Date-object into a JSONObject
What is the expected output? What do you see instead?
I expected a String representation of that Date, but I get it without
quotes, so the JSON is not valid.
What version of the product are you using? On what operating system?
version 1.1 of json-simple
To fix it, I have to "convert" the date by toString().
Original issue reported on code.google.com by [email protected]
on 20 Apr 2009 at 1:33
It would be nice if the parser were able to parse single quoted strings.
For example:
{ 'asdf' : 'qwer"zxcv', 'zxcv' : 'qwer\'zxcv' }
would be interpreted as:
{ "asdf" : "qwer\"zxcv", "zxcv" : "qwer'zxcv" }
Original issue reported on code.google.com by matt.fowles
on 16 Mar 2010 at 6:45
In the class JSONObject, the method:
String toJSONString(Map map)
uses on every entry in the map, the private method :
String toJSONString(String key, Object value, StringBuffer sb)
But this solution leads to poor perfomances on big maps, because the second
method not only append 'key' and 'value' to the specified StringBuffer 'sb',
but it also returns a String representation of the StringBuffer 'sb' (
returning sb.toString() ). This toString conversion is expensive and can be
unnecessary for the caller of the method.
It will be better if the method will have as signature :
void toJSONString(String key, Object value, StringBuffer sb)
leaving to the the caller of the method the responsability to convert the
buffer in a String, only when needed.
In effect, the method :
String toJSONString(Map map)
show poor performances while executed on big maps, suffering for this
unnecessary conversion on the internal method :
String toJSONString(String key, Object value, StringBuffer sb)
In our test, on a map with about 16000 entries, it is about 500-1000 times
slower compared to an experimental implementation that uses a new method :
void toJSONString(String key, Object value, StringBuffer sb)
Original issue reported on code.google.com by [email protected]
on 11 May 2011 at 10:37
I just noticed that parse exceptions return null when I do a
ParseException.getMessage(), so the only sensible way to create a meaningful
error message is either to look at the getErrorType() + getErrorPosition()
methods or call the toString() method (which actually produces a nice message!)
Vladimir
Original issue reported on code.google.com by [email protected]
on 18 May 2011 at 3:12
What steps will reproduce the problem?
1.
String a[] = { "first", "second" };
String val= JSONValue.toJSONString(a);
System.out.println(JSONValue.toJSONString(a));
What is the expected output?
[ "first", "second" ]
What do you see instead?
[Ljava.lang.String;@13e8d89
Please provide any additional information below.
Arrays of all basic types mentioned in
http://code.google.com/p/json-simple/wiki/MappingBetweenJSONAndJavaEntities
should be handled too.
Additionally also arrays of basic java types (char, int, long) should be
handled too.
Original issue reported on code.google.com by [email protected]
on 1 Jul 2010 at 7:01
As I see in library code:
http://code.google.com/p/json-simple/source/browse/trunk/src/org/json/simple/JSO
NValue.java#39
{{{
public static Object parse(Reader in){
try{
JSONParser parser=new JSONParser();
return parser.parse(in);
}
catch(Exception e){
return null;
}
}
}}}
The idea is to return some value or null if some problem happened,
no matter RuntimeException or Checked Exception.
But code in parser may throw Error:
http://code.google.com/p/json-simple/source/browse/trunk/src/org/json/simple/par
ser/Yylex.java#474
{{{
throw new Error(message);
}}}
so catch-block: "catch(Exception e)" will not catch Error, and
user, me, will get some Error exception in code.
The idea of errors, as far as I know is to highlight SIGNIFICANT
problems in application, when application probably can not work
any more, e.g.:
http://java.sun.com/javase/6/docs/api/java/lang/NoClassDefFoundError.html
Application can not run if some code is not found.
But Error from json_simple may be thrown even on invalid input string,
which, I think, should be handled as some sort of RuntimeException.
Original issue reported on code.google.com by [email protected]
on 24 May 2010 at 8:38
What steps will reproduce the problem?
1. Create a json object with a java string like so,
String jsonStr = "{\"class\":\"test\"}"
2. Parse the string with JSONObject and try to get the value for the key
name class.
Object obj=parser.parse(jsonStr);
JSONObject jObj = (JSONObject) obj;
System.out.println("Key name: class, Key value: " + jObj.get("class"));
What is the expected output? What do you see instead?
I expect to get the value "test" however, it always comes back with a null
value.
What version of the product are you using? On what operating system?
json-simple-1.1.jar on Windows XP.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Feb 2010 at 4:16
In toJSONString:
{{{
...
if(value instanceof String)
...
}}}
maybe use CharSequence:
{{{
...
if(value instanceof CharSequence)
...
}}}
Reason: GString( groovy strings), StringBuilder converted as toString()
without ""
Original issue reported on code.google.com by [email protected]
on 15 Nov 2009 at 2:15
Attachments:
What steps will reproduce the problem?
1. Send the following JSON into the JSONValue parser/lexer:
{
foo: "foo"
bar: "bar"
}
What is the expected output? What do you see instead?
This should produce an error because there is no comma between the value of foo
and the key bar. The correct JSON should be:
{
foo: "foo",
bar: "bar"
}
What version of the product are you using? On what operating system?
1.1
Original issue reported on code.google.com by [email protected]
on 6 May 2011 at 6:30
What steps will reproduce the problem?
1. It'd be nice if JSONValue.writeJSONString() and JSONValue.toJSONString()
handled arrays. Right
now it'll serialize Lists, but an array is serialized by calling toString() on
the array.
What version of the product are you using? On what operating system?
Using the latest version 1.1
Please provide any additional information below.
I've attached a patch that works with arrays.
Original issue reported on code.google.com by [email protected]
on 4 Dec 2009 at 7:26
Attachments:
What steps will reproduce the problem?
1. create String s = "/* a comment */ { "name":"value" }
2. try using this string in the parser.
3. watch the parser fail.
What is the expected output? What do you see instead?
{ "name":"value" }
What version of the product are you using? On what operating system?
Windows OS
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 9 Sep 2009 at 6:21
What steps will reproduce the problem?
1. Seen in production and not able to reproduce yet
2. Currently assuming that it is happening because of a large array of data.
What is the expected output? What do you see instead?
Expected object to be converted to a JSON string. Instead, ran out of heap.
What version of the product are you using? On what operating system?
version 1.1
jdk1.6.0_13
SunOS 5.10
Please provide any additional information below.
... caught exception: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder. java:100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572)
at java.lang.StringBuffer.append(StringBuffer.java:320)
at org.json.simple.JSONObject.toJSONString(Unknown Source)
Original issue reported on code.google.com by [email protected]
on 25 May 2011 at 8:49
If you change
JSONValue:150, 151, 205 and 206 to java.util.Collection instead of
java.util.List
and
JSONArray:32 and 72 (method definitions) to Collection instead of List
it'll work with other types of collections (such as Set) too!
Original issue reported on code.google.com by [email protected]
on 20 May 2010 at 7:55
JSONObject extends HashMap. Effective Java by Joshua Bloch suggests that
JSONObject should not extend HashMap. Instead JSONObject should use HashMap as
a private field and be delegated to instead.
http://java.sun.com/docs/books/effective/toc.html
Item 16: Favor composition over inheritance.
Original issue reported on code.google.com by [email protected]
on 10 Jul 2010 at 5:08
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.