• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

FlexJSON for JDK 1.4 to with JQuery JqGrid

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm trying to convert a list of Pojo into a Jquery specific JSON string. Learned that FlexJSON does the trick. But it works only for JAVA 5. Does someone know the similar solution for JDK 1.4? I've done enough search over the internet but in vain so far.

Thanks
Vicky
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are a lot of json libraries written in/for java. Google is your friend for that. I believe that http://stringtree.org/stringtree-json.html might work out for you though. Written by our very own staff member Frank Carver.
 
vicky kumar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greg,
I am specifically looking for JSON library that can genrate JqGRID (JQuery) specific JSON format. JqGrid demands a different JSON format for which you had mentioned to use FlexJSON in your blog. But that needs JAva 5. I am using JDK1.4. Look at the JSON format below for JqGrid:

{ total: "xxx", page: "yyy", records: "zzz",
rows : [ [id:"1", cell:["cell11", "cell12", "cell13"]],
[id:"2", cell:["cell21", "cell22", "cell23"]]
] }

The format above
cell:["cell11", "cell12", "cell13"]
is different than what JSON actually generates:
"cell":[{"key1:value1", "key2:value", "key3:value3"}]

Thanks
Vicky
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vicky, you are looking at the problem the wrong way. jqgrid can use a JSON response, yes and there is a specific pattern to it, not really a format. JSON can only be formatted one way. The trick was not getting the right JSON library but getting the Java objects right.

You can use any JSON library and assuming you use the objects that I created it should work.
 
vicky kumar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Gregg. I actually got stuck in "deepserialize" whcih I think is
irrelevant. Its working now.

Vicky
 
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic