Performance

76 views
Skip to first unread message

John

unread,
Oct 25, 2010, 11:30:35 AM10/25/10
to json-io
So far, json-io is the fastest Java to JSON and JSON to Java
serialization I've seen. Furthermore, in most cases it is faster than
Java's own ObjectInputStream and ObjectOutputStream.

If you have any suggestions or tweaks for performance, please discuss
those here.

Chet Hawkins

unread,
Jul 18, 2012, 10:31:08 PM7/18/12
to jso...@googlegroups.com
Hi.  I am new to java itself as well as many of the concepts I am trying to use.  Your JScript example does not show how the library is referred to within the JSP.   I am trying to serialize a database class into the value of one name value pair on the querystring.  Your library imports just fine inside my java database class code and the import for my bean is the same in both the jsp and the database class code.  Using that I tried to put this in my jsp file: <%@page import"com.cedarsoftware.util.io.*" %> which doesn't seem to find the library the way my database class code file does.  Sorry for the very basic question.  What am I doing wrong?  I realize it may be several things.

John DeRegnaucourt

unread,
Jul 19, 2012, 10:13:48 PM7/19/12
to jso...@googlegroups.com
The JsonReader / JsonWriter code is used within Java (not Javascript).  Typically, in Javascript, you make a call to a web server (usually and Ajax call as a Json payload).  The server does the processing for the call and then sends a HTTP response in JSON format.  The return value is now automatically (via auto-vivification) Javascript objects to be read and used within the web page.  If the object graph returned by your server has more than one reference to the same instance, these will show up as "@ref":n fields where 'n' is the id of the object being referenced.  In these cases, make sure to pass the JSON return data to jsonUtil.js 's resolveRefs(jsonData).  This will substitute the referenced objects with the appropriate pointers.

Basically, the Javascript code looks like this:

var result = ajaxCall("someControllerClass", "someMethod", ["arg1", "arg2"]);
resolveRefs(result);

if (result.status === true)
{
    
}

I will be posting a json-dispatcher-servlet as a Google-Code project that runs on Tomcat (any Java Webserver).  This servlet and a few utility methods in jsonUtil.js make it a snap to build a system in a 
"command pattern" way, where the Javascript code can call methods on "Controller" classes, and then use the results to build the page.  Combined this with JQuery and you can build very dynamic (interactive) web UIs.

Robert Dunn

unread,
Jul 20, 2012, 4:54:23 AM7/20/12
to jso...@googlegroups.com
Excellent!  That is exactly my situation.  I need controller command pattern utility.  Very anxious to see it.  Thanks for the reply!

Robert L Dunn
ser...@yahoo.com
"Things do not have to last forever to be perfect"
Matthew 7:6 "'Do not give what is holy to the dogs; nor cast your pearls before swine, lest they trample them under their feet, and turn and tear you in pieces.'"

Krishnamurti: “It is no measure of health to be well adjusted to a profoundly sick society.”

Winnie the Poo: “If the person you are talking to doesn't appear to be listening, be patient. It may simply be that he has a small piece of fluff in his ear.”


--- On Thu, 7/19/12, John DeRegnaucourt <jde...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages