JSON parser for J2ME
Asked Answered
C

2

9

I need a basic JSON parser that works with J2ME / CLDC 1.1.

A Google search returns tons of answers on this (some even on stackoverflow), but it appears that all point to libraries and solutions that are no longer available (for example, lots point to an implementation that is supposed to be on the json.org site, but at least I can't find anything that isn't J2SE only there).

My best hope so far is the source linked here: https://meapplicationdevelopers.dev.java.net/mobileajax.html, but from that one I can't even find a straight forward way to download the code.

Given the mature state of Java in all other aspects, surely there must be somewhere I can get a pre-compiled JAR to use for parsing JSON from J2ME?

Claribel answered 5/6, 2010 at 17:19 Comment(1)
I found where the code is now: java.net/projects/meapplicationdevelopers/sources/svn/show. Seems they migrated the site, left most of the old site there, but broken, and have some broken links on the new site that refer to the old one. New site does have source though.Buyers
C
14

After getting the accepted answer from ZZ Coder, I downloaded the linked code and built a JAR from it.

So in case you need a compiled JSON serializer/deserializer for J2ME/CLDC, you can find the source code here: https://bitbucket.org/liedman/json-me

Claribel answered 8/6, 2010 at 8:17 Comment(4)
do you still have the JAR ?? I built it from the code, but I must be doing something wrong because I get some errors and warnings when I add the jar to my projectNorthumbrian
please share the jar if you still have it.Northumbrian
The blog link for downloading the JAR is no longer functional.Snakebite
Can you provide a quick tutorial for this? Maybe in a Q&A style with an expanded answer here? Like which method to call on an object?Pasquil
P
7

There is an org.json parser for J2ME but I can't remember the original link. You can get the source code here,

http://grt192.googlecode.com/svn/trunk/CannonBot/src/org/json/me/

Patrizius answered 5/6, 2010 at 17:24 Comment(5)
Thanks, but is it really J2ME compatible? I see no mention of J2ME, and using it in my project results in java.util.HashMap being referenced, which isn't in CLDC as far as I know. Looking closer at the code, it seems to rely on J2SE's collection API quite a lot. Am I missing something?Claribel
Not familiar with CLDC. If it has Hashtable like MIDP, there is J2ME version of this. I can't find the original site but you can get code here grt192.googlecode.com/svn/trunk/CannonBot/src/org/json/me and hope it will compile on CLDC.Patrizius
That link was much more what I was hoping for. Even though it isn't compiled, it was easy enough to get the files and build myself. Would you consider posting that link as your answer (or a new answer, if you prefer), I would be happy to upvote/accept it.Claribel
@ZZCoder do you still have the JAR ?? I built it from the code, but I must be doing something wrong because I get some errors and warnings when I add the jar to my projectNorthumbrian
This resource is not longer available.Navarra

© 2022 - 2024 — McMap. All rights reserved.